PythonCharmers/python-future

print() behavior change

Open

#473 geöffnet am 4. Juni 2019

Auf GitHub ansehen
 (0 Kommentare) (0 Reaktionen) (1 zugewiesene Person)Python (327 Forks)batch import
0.19bughelp wanted

Repository-Metriken

Stars
 (1.172 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

$ cat print_failure.py 
print 'foo\n',
print 'bar\n',
$ python print_failure.py | xxd
00000000: 666f 6f0a 6261 720a                      foo.bar.
$ futurize -nw --no-diffs print_failure.py
$ cat print_failure.py 
from __future__ import print_function
print('foo\n', end=' ')
print('bar\n', end=' ')
$ python print_failure.py | xxd
00000000: 666f 6f0a 2062 6172 0a20                 foo. bar.

If the to be printed thing ends with a newline an additional space character is added to the output.

Contributor Guide