<分区> 分区>
我经常发现自己在做以下事情:
a = [1, 3, 2]
b = 'blah blah'
...
print("{} {} {} {}".format(b, a[0], a[1], a[2]))
>blah blah 1 3 2
有没有办法将数组转换为参数列表?我的意思是等同于:
print("{} {} {} {}".format(b, a))#Not valid Python code
>blah blah 1 3 2
或者,是否有更好的方法在格式化字符串中使用列表?
