adding elements to python tuples
arjen.dijkstraNoSpam at hccnet.nl
Mon Jan 19 12:35:57 CET 2004
Maybe you could use this?
(1, 2, 3, 4, 5)
"Uwe Mayer" <merkosh at hadiko.de> schreef in bericht
news:bugels$6u$1 at news.rz.uni-karlsruhe.de...
> is it possible to append new elements to a tuple? I know tuples are
> immutable and that this would mean to create a new tuple with one more
> element, but how do you do it?
> i.e. i have (1,2,3) and want to append 4:
> (1,2,3,4) instead of ((1,2,3),4)
> I wanted to use it as a return value of a function and an assignment, but:
> (a,b,c),d = myfunc()
> doesn't look nice to me. I intended to have
> a,b,c,d = myfunc()
> Thanks for any suggestions.
More information about the Python-list