|
发表于 2020-3-16 11:46:42
|
显示全部楼层
0 b; }; h, r; V( c1 M5 A1 w! C3 T* Y% ]8 F0 Y3 \7 N# [: F( T m0 L
- import re {" \) ?; M0 s7 v5 R1 |! F
0 u8 ^, V$ s& l$ E1 a- string = """file = {E\:\\storage\\BUUXZJBF\\Kottwitz - 2011 - Xyz beginner's guide \; one book name .pdf},, Y0 Q1 ]9 T8 i
- file = {E\:\\storage\\BZ7QHC8S\\Xyz programming - an introduction..pdf;E\:\\storage\\I5CN6Q4Y\\ABC Programming Advanced Introduction.7z;E\:\\storage\\LIEKLY4B\\NO programming - an advanced introduction chs..pdf;E\:\\storage\\4UVU3D66\\www.ccc-intro.org.html},7 i9 F) s& _1 q; {, i
- howpublished = {http://www.123.org/}" }% z/ b- K9 e# J2 n
- file = {E\:\\storage\\CUUXZJBG\\Tomz - 2015 - OK beginner's guide another book name.pdf}"""2 d( {, D; h% B% W/ J/ Y1 X, R4 e
/ ^9 {# {( c4 u4 ~9 B" @- % v9 J* A9 N2 V1 T |, w1 `, O. b. ^
- pattern = re.compile(r"\\([0-8A-Z]{8})\\([^:}]+?\.pdf)")
6 _" _$ o4 o7 A3 d7 {3 w5 |
$ [" M% F+ y+ v- m = pattern.findall(string)& P) n5 V- z. Z4 c( F
8 U7 L( d$ }2 P0 G( K( |* v- for item in m:
+ j8 P' s" ~. `& ?4 \! _ - print(item)
复制代码
! t. {$ c9 d8 M S) U& N7 p+ E" r
输出, i2 Y G; x. T, S, f4 ]
& v1 B0 D+ H' H; j% {- ('BUUXZJBF', "Kottwitz - 2011 - Xyz beginner's guide \\; one book name .pdf") Q( x+ K7 _+ }0 D: W L# o: \# I
- ('BZ7QHC8S', 'Xyz programming - an introduction..pdf')! B0 }+ p1 m: U: g, n1 N
- ('LIEKLY4B', 'NO programming - an advanced introduction chs..pdf')
' P% I9 R" i# H9 x. M* ] - ('CUUXZJBG', "Tomz - 2015 - OK beginner's guide another book name.pdf")
复制代码
: |; M, q+ @) }, \3 q2 k
1 ^) E, |( g: M2 D& h |
评分
-
1
查看全部评分
-
|