Commit 9725d0dd authored by Guido van Rossum's avatar Guido van Rossum

Tim wins a bet. Don't use re.

parent 17630a77
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"Replace CRLF with LF in argument files. Print names of changed files." "Replace CRLF with LF in argument files. Print names of changed files."
import sys, re, os import sys, os
for file in sys.argv[1:]: for file in sys.argv[1:]:
if os.path.isdir(file): if os.path.isdir(file):
print file, "Directory!" print file, "Directory!"
...@@ -11,7 +11,7 @@ for file in sys.argv[1:]: ...@@ -11,7 +11,7 @@ for file in sys.argv[1:]:
if '\0' in data: if '\0' in data:
print file, "Binary!" print file, "Binary!"
continue continue
newdata = re.sub("\r\n", "\n", data) newdata = data.replace("\r\n", "\n")
if newdata != data: if newdata != data:
print file print file
f = open(file, "wb") f = open(file, "wb")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment