https://www.cnblogs.com/euge/p/15178802.html
230919更新下新的格式化字符串方式
https://blog.csdn.net/XianZhe_/article/details/115715061
使用星号*(在Python中称为“unpacking”):
lst = [1,2,3]
valstring = "one: {}, two: {}, three: {}".format(*lst)
print(valstring)
如果要为任意长的输入生成这些字符串,可以使用^{<cd1 style="box-sizing: content-box;">}</cd1>包来获取整数的英文单词。在
import inflect
eng = inflect.engine()
l = [5, 4, 3, 2, 1]
pairs = ['{}: {}'.format(eng.number_to_words(index), value) for index, value in enumerate(l, start=1)]
print(', '.join(pairs))
# one: 5, two: 4, three: 3, four: 2, five: 1