1.%
age = 18
country = "中国"
print("我的年龄是%d岁" % age)
print("我的国籍是%s" % country)
print("我的年龄是%d岁,我的国籍是%s" % (age, country))
2.format 函数
str = "我的名字是{},我的国籍是{}".format("张三", "中国")
print(str)
3.sys.stdout
print ('hello world')
sys.stdout = temp #恢复默认映射关系
print ('nice')
sys.stdout.write('hello'+'\n')