From be19ed77ddb047e02fe94d142181062af6d99dcc Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 9 Feb 2007 05:37:30 +0000 Subject: Fix most trivially-findable print statements. There's one major and one minor category still unfixed: doctests are the major category (and I hope to be able to augment the refactoring tool to refactor bona fide doctests soon); other code generating print statements in strings is the minor category. (Oh, and I don't know if the compiler package works.) --- Lib/gopherlib.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'Lib/gopherlib.py') diff --git a/Lib/gopherlib.py b/Lib/gopherlib.py index d789161e60a..2fad21c9bfc 100644 --- a/Lib/gopherlib.py +++ b/Lib/gopherlib.py @@ -103,7 +103,7 @@ def get_directory(f): while 1: line = f.readline() if not line: - print '(Unexpected EOF from server)' + print('(Unexpected EOF from server)') break if line[-2:] == CRLF: line = line[:-2] @@ -112,17 +112,17 @@ def get_directory(f): if line == '.': break if not line: - print '(Empty line from server)' + print('(Empty line from server)') continue gtype = line[0] parts = line[1:].split(TAB) if len(parts) < 4: - print '(Bad line from server: %r)' % (line,) + print('(Bad line from server: %r)' % (line,)) continue if len(parts) > 4: if parts[4:] != ['+']: - print '(Extra info from server:', - print parts[4:], ')' + print('(Extra info from server:', end=' ') + print(parts[4:], ')') else: parts.append('') parts.insert(0, gtype) @@ -140,7 +140,7 @@ def get_alt_textfile(f, func): while 1: line = f.readline() if not line: - print '(Unexpected EOF from server)' + print('(Unexpected EOF from server)') break if line[-2:] == CRLF: line = line[:-2] @@ -196,13 +196,13 @@ def test(): f = send_selector(selector, host) if type == A_TEXT: lines = get_textfile(f) - for item in lines: print item + for item in lines: print(item) elif type in (A_MENU, A_INDEX): entries = get_directory(f) - for item in entries: print item + for item in entries: print(item) else: data = get_binary(f) - print 'binary data:', len(data), 'bytes:', repr(data[:100])[:40] + print('binary data:', len(data), 'bytes:', repr(data[:100])[:40]) # Run the test when run as script if __name__ == '__main__': -- cgit v1.2.3