list of lists of lists ....
faulkner
faulkner612 at comcast.net
Fri Jul 28 14:32:10 EDT 2006
recursion.
def get_As(L):
res = []
for elem in L:
if isinstance(elem, A):
res.append(elem)
elif isinstance(elem, list):
res += get_As(elem)
return res
i also have a Tree class in my rc:
http://home.comcast.net/~faulkner612/programming/python/pythonrc.py
yomgui wrote:
> Hi,
>
> I have a list of data (type A)
> my list can includes element of type A or a lists,
> these list can includes element of type A or a lists, and so on ...
>
> is there a simple way to obtain a single list of all the elemets
> of type A ?
>
> thanks
>
> yomgui
More information about the Python-list
mailing list