天天看點

from __future__ import print_function 使用

當你是在python3的環境下完成的代碼編寫,使用print時一般需要帶上括号。

而你的代碼可能會被使用python2的人所使用,python2的print無需帶上括号。

為了統一print規範,可以在代碼的開頭帶上這一行:

from __future__ import print_function