Python2.x与3.x的区别之“print”
正如错误提醒的那样:
Missing parentheses in call to ‘print’. Did you mean print(‘xxxxx’);
在Python3.x之中print语句没有了,取而代之的是print()函数。
#!/usr/bin/python
# -*- coding: UTF-8 -*-
flag = False
name = 'lin'
if name == 'python':
flag = True
print ('hello world')
else:
print (name)
注: Python 2.6与Python 2.7部分地支持这种形式的print语法。