[error]

时间:2017-01-23 22:31:26   收藏:0   阅读:262

1、

输入:>>>print"hha"
SyntaxError: invalid syntax  

原因:要写空格

 

2、
>>> print "hello"
SyntaxError: Missing parentheses in call to ‘print‘

原因:Mac安装俩个Python版本,2和3,python2系列可以支持 print “xxxx” ,python系列需要使用print("xxx")

解决:
>>> print("hello")
hello

 

3、

>>> a=‘123‘
>>> print(‘1‘)
1
>>> print(‘1‘) in a
1
Traceback (most recent call last):
File "<pyshell#52>", line 1, in <module>
print(‘1‘) in a
TypeError: ‘in <string>‘ requires string as left operand, not NoneType

原文:http://www.cnblogs.com/amanon/p/6344950.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!