You could recursively call a flattening function:
cherry_field = ['cherry1', ['cherry2', ['cherry3', ['cherry4', ['last cherry', None]]]]]
def flatten(input_list):
result = []
for item in input_list:
if isinstance(item, list):
# flatten returns a flat list, extend appends
# the contents of this list to the end of result
result.extend(flatten(item))
else:
result.append(item)
return result
This outputs
['cherry1', 'cherry2', 'cherry3', 'cherry4', 'last cherry', None]
You can then just print each item in the result. Here, we are simply recursively flattening any encountered lists, with the base case being an item that is not a list, and therefore is just appended.
For a lazier approach that does not involve creating a new list, you can use a generator:
def flatten(input_list):
for item in input_list:
if isinstance(item, list):
for yielded_item in flatten(item):
yield yielded_item
else:
yield item
Then simply write:
for item in flatten(cherry_field):
print(item)