Write a python function to flatten nested lists
Topic: Write a python function to flatten nested lists
Solution
from collections import Iterable def flatten(lis): for item in lis: if isinstance(item, Iterable) and not isinstance(item, str): for x in flatten(item): yield x else: yield item
List all Python Programs