mirror of
https://github.com/python/cpython.git
synced 2025-08-29 13:15:11 +00:00
#2650: Refactor re.escape to use enumerate().
This commit is contained in:
parent
7b9e97b487
commit
ebbf1e67a8
1 changed files with 1 additions and 2 deletions
|
@ -223,8 +223,7 @@ def escape(pattern):
|
|||
if isinstance(pattern, str):
|
||||
alphanum = _alphanum_str
|
||||
s = list(pattern)
|
||||
for i in range(len(pattern)):
|
||||
c = pattern[i]
|
||||
for i, c in enumerate(pattern):
|
||||
if c not in alphanum:
|
||||
if c == "\000":
|
||||
s[i] = "\\000"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue