pythonclock.org is a pretty simple countdown for the end of Python 2.
The End Of Life, sunset date for Python 2.7 is officially announced to January 1, 2020.
It’s not a 1 April fool joke and not a really something new.
Python 3, a major, backwards-incompatible release, was released on December 3, 2008. [2]
So lets say, it was pretty clear who has not switched to Python 3 version,
it’s your own fault.
This a simple dive in for converting Python code from version 2 to Python 3.
2to3 is a Python program that reads Python 2.x source code and applies a series of fixers to transform it into valid Python 3.x code.
pip3 install 2to3
Basic usage, the converted Python3 code will shown on stdout:
2to3 example.py
Inline converting with auto backup creation example.py.bak:
2to3 -w example.py
From now, worry only about supporting your Python 3 code ;)
This tools will help you to make sure, you code will be runable and readable.
pip3 install pylint
pip3 install pycodestyle
pip3 install autopep8
Run code verifications for your code:
pylint example.py
pycodestyle example.py
autopep8 example.py
Sources:
[1] Porting Python 2 Code to Python 3
[2] What’s New In Python 3
Leave a Reply