How can I use string.format() in a fashion such that:
line = 'first {0}, second {1}'
print(line.format([1,2]))
would print first 1 second 2.
You can unpack the list:
>>> line = 'first {0}, second {1}'
>>> l = [1, 2]
>>> print(line.format(*l))
first 1, second 2
l is generally best avoided to avoid confusion between I, l and 1 </pedant>
line = 'first {}, second {}'