Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7333c4c commit 3a8d1f5Copy full SHA for 3a8d1f5
1 file changed
Lib/re.py
@@ -64,13 +64,13 @@ def findall(pattern, string):
64
65
def escape(pattern):
66
"Escape all non-alphanumeric characters in pattern."
67
- result = []
+ result = list(pattern)
68
alphanum=string.letters+'_'+string.digits
69
- for char in pattern:
+ for i in range(len(pattern)):
70
+ char = pattern[i]
71
if char not in alphanum:
- if char=='\000': result.append('\\000')
72
- else: result.append('\\'+char)
73
- else: result.append(char)
+ if char=='\000': result[i] = '\\000'
+ else: result[i] = '\\'+char
74
return string.join(result, '')
75
76
def compile(pattern, flags=0):
0 commit comments