How to extend a tuple of tuples?
dieter
dieter at handshake.de
Fri Sep 9 02:56:31 EDT 2016
"Frank Millman" <frank at chagford.com> writes:
> Hi all
>
> This should be easy, but I cannot figure it out.
>
> Assume you have a tuple of tuples -
>
> a = ((1, 2), (3, 4))
>
> You want to add a new tuple to it, so that it becomes -
>
> ((1, 2), (3, 4), (5, 6))
>
> The obvious way does not work -
>
> a += (5, 6)
>
> ((1, 2), (3, 4), 5, 6)
You could use:
a += (5, 6),
or (more clearly written):
a += ((5, 6),)
More information about the Python-list
mailing list