这个错误是由于在python2.7中,print不是一个函数而是一个语句。当你使用print时,你不需要使用括号。在python2.7中,你应该这样使用print:

print "Hello, World!"

而不是这样:

print("Hello, World!")

如果你使用了括号,就会得到“cannot assign to literal”错误。

Python 2.7.10 print 函数报错:cannot assign to literal - 解决方法

原文地址: https://www.cveoy.top/t/topic/pDgG 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录