Tim wins a bet. Don't use re.

This commit is contained in:
Guido van Rossum 2002-11-13 21:04:31 +00:00
parent 3f1c9a916f
commit affa6b7bf1
1 changed files with 2 additions and 2 deletions

View File

@ -2,7 +2,7 @@
"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:]:
if os.path.isdir(file):
print file, "Directory!"
@ -11,7 +11,7 @@ for file in sys.argv[1:]:
if '\0' in data:
print file, "Binary!"
continue
newdata = re.sub("\r\n", "\n", data)
newdata = data.replace("\r\n", "\n")
if newdata != data:
print file
f = open(file, "wb")