def WalkList2(thelist):
def WalkListRecursive(thelist):
# first split into iterable and non iterable objects
collections = []
for item in thelist:
if hasattr(item,"__iter__"): # returns true for list , tuples, .net-arrays and other collections but not Strings
collections.append(item) #save for iterating later
else:
result.append(item) #first collect all items of this level nesting
#second go to next level of nesting
for collection in collections:
WalkListRecursive(collection)
result = []
WalkListRecursive(thelist)
return result
arrPts = []
arrPts.append([2,3,4,5])
arrPts.append("hello")
arrPts.append(6)
arrPts.append([7,["vf","xx"],10])
unnested = WalkList2(arrPts)
print unnested