mirror of
https://github.com/python/cpython.git
synced 2025-10-21 14:12:27 +00:00
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:
parent
226878cba5
commit
7f13e6b3e2
9 changed files with 39 additions and 62 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue