mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Convert all remaining *simple* cases of regex usage to re usage.
This commit is contained in:
parent
426916e50e
commit
9694fcab53
23 changed files with 134 additions and 144 deletions
|
@ -39,8 +39,8 @@ class Cdplayer:
|
|||
f = open(posix.environ['HOME'] + '/' + cdplayerrc, 'r')
|
||||
except IOError:
|
||||
return
|
||||
import regex
|
||||
reg = regex.compile('^\\([^:]*\\):\t\\(.*\\)')
|
||||
import re
|
||||
reg = re.compile(r'^([^:]*):\t(.*)')
|
||||
s = self.id + '.'
|
||||
l = len(s)
|
||||
while 1:
|
||||
|
@ -49,11 +49,11 @@ class Cdplayer:
|
|||
break
|
||||
if line[:l] == s:
|
||||
line = line[l:]
|
||||
if reg.match(line) == -1:
|
||||
match = reg.match(line)
|
||||
if not match:
|
||||
print 'syntax error in ~/' + cdplayerrc
|
||||
continue
|
||||
name = line[reg.regs[1][0]:reg.regs[1][1]]
|
||||
value = line[reg.regs[2][0]:reg.regs[2][1]]
|
||||
name, valye = match.group(1, 2)
|
||||
if name == 'title':
|
||||
self.title = value
|
||||
elif name == 'artist':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue