唯一的其他方法是使用Python 2.6 + /
3.x
.format()方法进行字符串格式化:
# dict must be passed by reference to .format()print("{foo}, {bar}, {baz}").format(**locals())或通过名称引用特定变量:
# Python 2.6print("{0}, {1}, {2}").format(foo, bar, baz)# Python 2.7/3.1+print("{}, {}, {}").format(foo, bar, baz)


