输出
name = 'fty'
print(name)
>>> fty
格式化输出
name = 'fty'
print("my name is:%s" % name)
>>> my name is:fty
输出两个参数
name = 'fty'
age = '23'
print('my name is %s and age is %s' % (name, age))
>>> my name is fty and age is 23
多个参数时将多个参数放入小括号中,逗号隔开
字符串拼接
1 通过加号拼接
first_naem = 'f'
last_name = 'ty'
name = first_name + last_name
>>> fty
2 通过格式化字符串
first_name = 'f'
last_name = 'ty'
name = "===%s===" % (first_name + last_name)
>>> ===fty===