string.maketrans() now produces translation tables for bytes.translate() -- wrong module?

Fix all remaining instances that did bad things with the new str.translate().
This commit is contained in:
Georg Brandl 2007-08-31 10:37:15 +00:00
parent 226878cba5
commit 7f13e6b3e2
9 changed files with 39 additions and 62 deletions

View file

@ -1420,7 +1420,6 @@ def reporthook(blocknum, blocksize, totalsize):
# Test program
def test(args=[]):
import string
if not args:
args = [
'/etc/passwd',
@ -1443,9 +1442,7 @@ def test(args=[]):
fp = open(fn, 'rb')
data = fp.read()
del fp
if '\r' in data:
table = string.maketrans("", "")
data = data.translate(table, "\r")
data = data.replace("\r", "")
print(data)
fn, h = None, None
print('-'*40)