
If the next print statement printed a carriage return, would be set to 0 and the space would never be printed. The space character wasn’t really printed until something else got printed on the same line.

Instead of printing a space, Python 2 would set to 1. The print statement in Python 2 used a now-deprecated attribute called softspace. (Technically, it’s a little more complicated than that. In Python 2, if you ended a print statement with a comma, it would print the values separated by spaces, then print a trailing space, then stop without printing a carriage return.
Difference between zip and izip python how to#
Case study: porting chardet to Python 3 describes how to run the 2to3 script, then shows some things it can’t fix automatically. But don’t despair! To help with this transition, Python 3 comes with a utility script called 2to3, which takes your actual Python 2 source code as input and auto-converts as much as it can to Python 3.

So much has changed between Python 2 and Python 3, there are vanishingly few programs that will run unmodified under both. You are here: Home ‣ Dive Into Python 3 ‣ĭifficulty level: ♦♦♦♦♦ Porting Code to Python 3 with 2to3
