I would like to unpack a tuple in a python statement like so:
a = 5, *(6,7)
but this raises a SyntaxError. What is the cleanest way to achieve something like this?
The best I've come up with so far is:
a = tuple([5]+list((6,7)))
You can just concatenate the tuples directly:
>>> a = (5,)+(6, 7)
>>> a
(5, 6, 7)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With