您的位置:首页 > 其它

SyntaxError: Missing parentheses in call to 'print'

2017-10-08 22:24 483 查看
C:\Users\konglb>python
Python3.6.3(v3.6.3:2c5fed8,Oct32017,17:26:49)[MSCv.190032bit(Intel)]onwin32
Type"help","copyright","credits"or"license"formoreinformation.
>>>print'hello,pythonworld';
File"<stdin>",line1
print'hello,pythonworld';
^
SyntaxError:Missingparenthesesincallto'print'.Didyoumeanprint('hello,
pythonworld';)?


其实这个错误信息,是因为Python3中取消了以前Python2中的语法,两者在打印输出的语法上有所差别,所以在Python3下面使用之前的语法格式就会报错,错误信息已经提示你需要加上括号,字符串可以用单引号或双引号括起来,正确语法格式如下所示:

C:\Users\konglb>python-V
Python3.6.3
>>>print('hello,pythonworld')
hello,pythonworld
>>>print("youareright")
youareright
>>>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: