python2与python3的兼容
python2.x与python3.x的区别
比如最明显的print()函数
print语句变成print()函数
# print函数# sep表示间隔符号,可自行替换python2.x与python3.x的兼容
__future__包
目的:利用__future__包可实现python2.x与python3.x的兼容。
作用:__future__包禁用python2.x的语句,采用python3.x的print()函数。
比如最明显的print()函数
print语句变成print()函数
# print函数# sep表示间隔符号,可自行替换目的:利用__future__包可实现python2.x与python3.x的兼容。
作用:__future__包禁用python2.x的语句,采用python3.x的print()函数。