I'm trying to use the str.format()
method, and having some difficulties when my values are stored within a tuple. For example, if I do:
s = "x{}y{}z{}"
s.format(1,2,3)
Then I get 'x1y2z3'
- no problem.
However, when I try:
s = "x{}y{}z{}"
tup = (1,2,3)
s.format(tup)
I get
IndexError: tuple index out of range.
So how can I 'convert' the tuple into separate variables? or any other workaround ideas?