After adding the sentence from __future__ import print_function at the beginning, even in python2.X, using print has to be used with parentheses like python3.X. In python2.X print does not require parentheses, but in python3.X it is required.
# python2.7
print "Hello world"
# python3
print("Hello world")
If a new feature appears in a certain version, and this feature is incompatible with the current version, that is, it is in this version is not a language standard, so if I want to use it, I need to import it from the future module.
Other examples:
from __future__ import division ,
from __future__ import absolute_import ,
from __future__ import with_statement . Etc.
Add these, if your python version is python2.X, you have to use these functions as python3.X.
---------------------
Author: xiaotao_1
Source: CSDN
Original text: https://blog.csdn.net/xiaotao_1/article/details/79460365
Copyright statement: this article Original articles for bloggers, please attach a link to the blog post for reprinting!