How can I use functions that return multiple values as inputs to a format string, without getting the TypeError: not enough arguments for format string error?
>>> def foo():
... return 1, 2
...
>>> foo()
(1, 2)
>>> print "%d,%d,%d" % foo(), 3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: not enough arguments for format string
Expected output: "1,2,3"
print "%d,%d,%d" % (foo() + (3,))should do it.