Home > Article > Backend Development > What version of python is there?
The current mainstream versions of python are python2 and python3. Python2 is expected to stop maintenance in 2020. Beginners are recommended to learn python3 directly.
Next let’s talk about the differences between Python2 and Python3.
Basic syntax differences
##Core class differences
obsolete class difference
1. The print statement is abandoned by python3, and the print function is uniformly used.
2. The exec statement is abandoned by python3, and the exec function is uniformly used.
3. The execfile statement is abandoned by Python3. It is recommended to use exec(open("./filename").read())
##4. The inequality operator "<>" is abandoned by Python3, and the unified use is "!="5. The long integer type is abandoned by Python3, and int
is used uniformly.
6. The xrange function was abandoned by Python3, and range is used uniformly. The range mechanism in Python3 has also been modified and the efficiency of large data set generation has been improved.7. In Python3 These methods no longer return list objects: dictionary-related keys(), values(), items(), zip(), map(), filter(), but can be forcibly converted through the list
8. The next() function of iterator is abandoned by Python3, and next(iterator) is used uniformly
9. The raw_input function is abandoned by Python3, and the input function is uniformly used. 10. The has_key function of dictionary variables is abandoned by Python, and the in keyword is uniformly used. 11. The file function is abandoned by Python3. Open is used to process files. You can check the file type through io.IOBase. 12. The apply function is abandoned by Python3. 13. The exception StandardError was abandoned by Python3, and Exception is used uniformly Related learning recommendations: python tutorial
The above is the detailed content of What version of python is there?. For more information, please follow other related articles on the PHP Chinese website!