I have a list full of various bits of information that I would like to pass to several strings for inclusion via the new string format
method. As a toy example, let us define
thelist = ['a', 'b', 'c']
I would like to do a print statement like print '{0} {2}'.format(thelist)
and print '{1} {2}'.format(thelist)
When I run this, I receive the message IndexError: tuple index out of range
; when mucking about, it clearly takes the whole list as a single object. I would, of course, rather it translate thelist
to 'a', 'b', 'c'
.
I tried using a tuple and received the same error.
What on Earth is this particular technique called? If I knew the name, I could have searched for it. "Expand" is clearly not it. "Explode" doesn't yield anything useful.
My actual use is much longer and more tedious than the toy example.