Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # sublists_flatten.py
- L1 = [1, 2, 3]
- L2 = [4, 5, [], 6]
- L3 = [7, 8, 9, 'z']
- L = [L1, L2, L3]
- s=[x for y in L for x in y]
- print s
- ### ... or even better... ###
- print sum(L,[])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement