我想在 python 3 中运行此代码,但我不能。每当我尝试运行该代码时,我都会收到无效的语法错误。
age = 20 name = 'Swaroop' print '{} was {} years old when he wrote this book'.format(name, age) print 'Why is {} playing with that python?'.format(name)
在
print
print('{} was {} years old when he wrote this book'.format(name, age)) print('Why is {} playing with that python?'.format(name))
在Python2中,
在Python3中,