Even a well loved language like Python has its downsides.
One tricky issue is that there are two main Python versions, namely 2 and 3.
And, unfortunately, version 2 code often fails to run in a Python 3 environment, and visa versa.
So here's my quick guide.
Key Elements
The focus of your conversion efforts should be on:
• print and print()
• exception handling
• module import errors
• integer handling
• unicode characters
• using bytes
There's a very helpful guide on each of this topics at the Python 3 porting site.
And more useful information can be found on this blog page from Alexandre Vassalotti.
No Conversion Required
Do you want to create code that works in both versions?
Then head over to the no conversion chapter and find out how the Six utility works its magic.