我经常发现自己这样做:
myvariable = 'whatever'
another = 'something else'
print '{myvariable} {another}'.format(
myvariable=myvariable,
another=another
)
有没有办法不必以这种重复的方式命名关键字参数?我在想一些事情:
format_vars = [myvariable, another]
print '{myvariable} {another}'.format(format_vars)