基础 字符串是不可改变的 格式化方法:format() 将一下内容为文件 str_format.py age = 20 name = 'Swaroop' print('{0} was {1} years old when he wrote this book'.format(name, age)) print('Why is {0} playing with that python?'.format(name)) 输出: $ python str_format.py Swaroop was 20 years old when he wrote this book Why is Swaroop