For some reason I can't get isinstance() to work on Python 2.7.2
def print_lol(the_list, indent=False, level=0):
for item in the_list:
if isinstance(item, list):
print_lol(item, indent, level+1)
else:
print(item)
And when I compile and run it:
>>> list = ["q", "w", ["D", ["E", "I"]]]
>>> print_lol(list)
I get the error message:
if isinstance(item, list):
TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types
What am I mising?
listcalledlistin almost every python problem on SO...