Python 2.x vs. Python 3.x
Python 2.x is a legacy version which was last released in 2010(version 2.7.x) and discontinued after that, but the support for this version remained for the sake of backward compatibility. Python 3.x is considered the present and future edition of the language. Python 3.x is a preferred version to use because of these:-
- The overwhelming majority of third party python libraries support Python 3.x.
- Python 3.x has many features and performances benefits that aren’t available in Python 2.x.
- Also, the difference in syntax between the two versions are fairly minimal. It won’t take long to learn python 2.x if you need to.
How to check Python version in terminal?
python --version or py --version
How to check Python version programmatically?
import sys print(sys.version)
This is how we can know the version of python.