I construct a string
in Python 2.6.5 which will have a varying number of
tokens, which match the number of entries in list
. I need to write out a formatted string. The following doesn't work, but indicates what I'm trying to do. In this example, there are three
tokens and the list has three entries.
s = '%s BLAH %s FOO %s BAR'
x = ['1', '2', '3']
print s % (x)
I'd like the output string to be:
1 BLAH 2 FOO 3 BAR