def flatten(nested): result = [] try: try: nested + '' except TypeError: pass else: raise TypeError for sublist in nested: for element in flatten(sublist): result.append(element) except TypeError: result.append(nested) return result
Related Scripts with Example Source Code in same category :