[issue13119] Newline for print() is \n on Windows, and not \r\n as expected
STINNER Victor
report at bugs.python.org
Thu Aug 2 22:16:45 CEST 2012
STINNER Victor added the comment:
> I wonder why "print(1, file=sys.stderr)" returns '1' instead of '1\n'.
I suppose that you mean "returns '1\n' instead of '1'". This is a
major change between Python 2 and Python 3. Use print(1, end=' ') if
you want the same behaviour. See:
http://docs.python.org/dev/whatsnew/3.0.html#print-is-a-function
You can also use the print() as a function in Python 2 using "from
__future__ import print_function":
http://docs.python.org/dev/whatsnew/2.6.html#pep-3105-print-as-a-function
I never liked "print expr," because it looks like a typo or an ugly
hack. It's easy to add a comma by mistake.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13119>
_______________________________________
More information about the Python-bugs-list
mailing list