the following is a routine in the book:
def flatten(nested):
try:
-sharp
try:
nested + ""
except TypeError:
pass
else:
raise TypeError
for sublist in nested:
for element in flatten(sublist):
yield element
except TypeError:
yield nested
a = list(flatten([[[1], "abc"], 3, 4, [5, [6, 7]], [[[8, 9, 10], 11], 12], 13, 14]))
print(a)
pycharmraise TypeErrorraise SyntaxErrorTypeError...