Davy wrote:
> Hi all,
> 
> I am curious about whether there is function to fransform pure List to
> pure Tuple and pure Tuple to pure List?
> 
> For example,
> 
> I have list L = [[1,2,3],[4,5,6]]
> something list2tuple() will have T=list2tuple(L)=((1,2,3),(4,5,6))
> 
> And the tuple2list()
> 
> Any suggestions are welcome!

D = { list : tuple, tuple : list }

F = lambda x : D[type(x)](map(F,x)) if type(x) in D else x

list2tuple = tuple2list = F
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to