str.format() Python2.6之后新增的一宗格式化字符串的函数。 用{}和:来替换以前的% >>>"{} {}".format("hello", "world") # 不设置指定位置,按默认顺序 'hello world' >>> "{0} {1}".format("hello"