2017-07-23 83 views
0

嗨无效字符我刚开始用python.And而我想我的第一个程序我面临这个问题:语法错误:在标识符

python_mission = """ 
The mission of the Python Software Foundation is to promote, protect, 
and advance the Python programming language, and to support and 
facilitate the growth of a diverse and international community of 
Python programmer 
""" 
print(“The word returned is: {}”.format(python_mission[25:34])) 

Error: Invalid character in identifier

+1

你有卷曲的报价。 – Scimonster

+0

替换引号:'print(“返回的单词是:{}”.format(python_mission [25:34]))'' – Shai

回答

3

通知您在打印功能的报价是多么的不一个普通的双引号,但是是一个有角度的...当你的macOS的设置被设置为它们的缺省值以使用它们时获得的类型。

您需要的报价是定期的,所以......

print(“The word returned is: {}”.format(python_mission[25:34])) 

应该是...

print("The word returned is: {}".format(python_mission[25:34])) 

您也可以取消选中“使用智能引号和破折号”,以避免这种在未来:
enter image description here

相关问题