Python2 VS Python3
· β 1 min read
1. Differences Between Python 2 and 3 Feature \ Version Python 2 Python 3 print as a function print"abc" print(“abc”) Unified class Old-style and new-style classes New-style classes only Floating-point division 1/2=0 1/2=0.5 String formatting %, Format Format,% xrange replaces range xrange range long renamed to int Long,int Int Package imports Relative imports Absolute imports Source file encoding Ascii utf8 The official Python recommendation is strongly in favor of learning Python 3 directly, since Python 2 is only maintained through 2020.