list to tuple
rspivak at nuxeo.com
Fri Aug 12 07:22:13 CEST 2005
"zxo102" <zxo102 at gmail.com> writes:
> I got several dynamic lists a1, b1, c1, .... from a python
> application such as
> a1 = [1,5,3,2,5,...], the len(a1) varies. Same to b1, c1, ....
> With python, I would like to reorganize them into a tuple like
> t1 = ((a1,b1,c1,...),(a1,b1,c1,...),...)
> Anybody knows how to do that. Thanks for your help.
t1 = tuple(zip(a1, b1, c1))
I don't know your requirements, so consider also izip from itertools.
More information about the Python-list