Here are some main differences between Python 2.x and Python 3:
- Print: In Python 2, print is a statement. So, there is no need to wrap the text in parentheses for printing. But in Python 3 print is a function. So, you have to pass the string you need to print to the function in parentheses.
- Integer division: Python 2 considers numbers without any digits after the decimal point as integers, which may lead to some unexpected results during division.
- List comprehension loop variables leak: In Python 2, giving the variable that is iterated over in a list comprehension leaks the variable into surrounding scope, this list comprehension loop variable leak bug has been fixed in Python 3.
- Unicode strings ...