I need to create a nested tuple in which some values are the same, so I tried multiplying them.
t = ((('a', 'b'),) * 3)
print t
Prints
(('a', 'b'), ('a', 'b'), ('a', 'b'))
Is there a syntactically nicer way to do this?
Thanks.
One way is not using as many brackets:
t = (('a', 'b'), ) * 3
works just as well.
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