Python3.x中,使用print时出错(SyntaxError: Missing parentheses in call to 'print')解决办法

Python2到Python3,很多基本的函数接口变了,甚至有些库或函数被去掉或改名了 
在Python 3.x中,print是函数,这意味着需要编写print (a)而不是print a,除此之外,它的工作方式和语句差不多。

Python 2.x和Python 3.x中print函数语法方面的区别为:

# Python 2.x: 
print a # 要打印的内容a不带括号

# Python 3.x: 
print (a) # 要打印的内容a必须带括号

猜你喜欢

转载自blog.csdn.net/weixin_42670402/article/details/81912469
今日推荐