Python3.x运行Python2.x代码报错 syntax error "Missing parentheses in call to 'print'

#另外一种错误
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(

查看代码,格式如下:

print "文件%s不存在" % filename
。。。
print '-------xxx------'

改成
print ("文件%s不存在" % filename)
print ('-------xxx------')

参考:https://stackoverflow.com/questions/41341149/python-3-6-0-syntax-error-missing-parentheses-in-call-to-print?noredirect=1&lq=1

猜你喜欢

转载自www.cnblogs.com/passedbylove/p/11433235.html