‘{ }‘.format()的总结

tech2022-07-16  194

# 元组传值 print('my name is {}, age is {}'.format('lala',22)) # 列表传值 li = ['chenpeng',22] print('my name is {}, age is {}'.format(*li)) # 字典传值 hash = {'name':'chenpeng', 'age':20} print('my name is {name}, age is {age}'.format(**hash))
最新回复(0)