[error]

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

posted @ 2017-01-23 21:11  开怀  阅读(397)  评论(0编辑  收藏  举报