1、
1 #!/usr/bin/python 2 print "hello world!"
print报错:SyntaxError: Missing parentheses in call to 'print'
将打印字符加括号后不报错
1 #!/usr/bin/python 2 print("hello world!")
2、print type
1 #!/usr/bin/python 2 a = "smg" 3 print type(a)
type报错:
print type(a)
^
SyntaxError: invalid syntax
type函数括号后不报错
1 #!/usr/bin/python 2 a = "smg" 3 print( type(a) )
运行结果是:<class 'str'>