]> granicus.if.org Git - python/commitdiff
String method conversion.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 9 Feb 2001 16:56:44 +0000 (16:56 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 9 Feb 2001 16:56:44 +0000 (16:56 +0000)
Lib/multifile.py
Lib/string.py
Lib/stringold.py

index e0305d82b2ac112f9dab0bec0967d4937434e30c..60a4303c14bf14eedf6dab7795278541fd204b85 100644 (file)
@@ -28,7 +28,6 @@ seekable stream object.
 """
 
 import sys
-import string
 
 __all__ = ["MultiFile","Error"]
 
@@ -88,10 +87,7 @@ class MultiFile:
             return line
         else:
             # Ignore trailing whitespace on marker lines
-            k = len(line) - 1
-            while line[k] in string.whitespace:
-                k = k - 1
-            marker = line[:k+1]
+            marker = line.rstrip()
         # No?  OK, try to match a boundary.
         # Return the line (unstripped) if we don't.
         for i in range(len(self.stack)):
@@ -121,7 +117,7 @@ class MultiFile:
         return list
 
     def read(self): # Note: no size argument -- read until EOF only!
-        return string.joinfields(self.readlines(), '')
+        return self.readlines().join('')
 
     def next(self):
         while self.readline(): pass
index 61b253eee5635e3ad6e5d048f4708664822d0245..bdd9254966d50ceb23b32aad4d0da7090163c4b8 100644 (file)
@@ -356,7 +356,7 @@ def maketrans(fromstr, tostr):
     fromstr = map(ord, fromstr)
     for i in range(len(fromstr)):
         L[fromstr[i]] = tostr[i]
-    return joinfields(L, "")
+    return join(L, "")
 
 # Substring replacement (global)
 def replace(s, old, new, maxsplit=-1):
index c3e6f6f9ed49f5ac35e8d12e24e77103f8f8be98..dcc1143f9a0ada478767622174346db4e9c8f87f 100644 (file)
@@ -395,7 +395,7 @@ def maketrans(fromstr, tostr):
     fromstr = map(ord, fromstr)
     for i in range(len(fromstr)):
         L[fromstr[i]] = tostr[i]
-    return joinfields(L, "")
+    return join(L, "")
 
 # Substring replacement (global)
 def replace(s, old, new, maxsplit=0):