If you want to completely flatten a list of lists, you need to check if its iterable.
To do this you can create a generator which returns a non-iterable item, or recursively calls itself if the item is iterable.
Then place each element of the generator in a list, and print it.
Warning!!
This will crash with cycling lists ie l = []; l.append(l)
def get_single_elements(item):
if hasattr(item, '__iter__'):
for child_item in item:
for element in get_single_elements(child_item):
yield element
else:
yield item
def print_flat(item):
print [element for element in get_single_elements(item)]
>>> print_flat([[[0],[1]]])
[0, 1]
>>> print_flat([[[[[0,[1,2,[3,4]]]]],[[1]]]])
[0, 1, 2, 3, 4, 1]
Edit if you're sure you want to convert all items to ints, then write it like this
def print_flat(item):
print [int(element) for element in get_single_elements(item)]