]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Tim wins a bet. Don't use re.
authorGuido van Rossum <guido@python.org>
Wed, 13 Nov 2002 21:04:31 +0000 (21:04 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 13 Nov 2002 21:04:31 +0000 (21:04 +0000)
Tools/scripts/crlf.py

index 58181854016bc7115057d639e8f2a8e3e486ac0f..59e3ff3fc326fa0182eb45ae3b43c9a2160e209a 100755 (executable)
@@ -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")