print() with no newline

ElChino elchino at cnn.cn
Sun Dec 18 08:11:17 EST 2016


Chris Warrick wrote:

>> I'm getting a syntax error in Python2. Python3 is fine.
>> How can I make this Py2+3 compatible?
> 
> With a __future__ import, the Python 3 syntax will work with both Pythons:
> 
> from __future__ import print_function
> print(s, end="")

Thanks. Lovely.





More information about the Python-list mailing list