Kaydet (Commit) e37340ed authored tarafından Eric S. Raymond's avatar Eric S. Raymond

String method conversion.

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