1. str.format() 使用
直接用花括號
print('My name is {},{} years old!'.format('xiaoming','28'))
使用格式化字段
print('My name is {0},{1} years old!'.format('xiaoming','28'))
使用變量
print('My name is {name},{age} years old!'.format(name='xiaoming',age='28'))
name='xiaoming'
print('His name is %s ' %name)