how to extract nested lists?

Duplicates:

Lets say I have a list with nested lists:

[["a","b","c"], ["d","e","f"], ["g","h","i","j"]...]

what is the best way to convert it to a single list like that

["a", "b", "c", "d", "e"....]

Answers


Use itertools.chain:

from itertools import chain

list(chain.from_iterable(list_of_lists))

Need Your Help

How to use UIViewControllerAnimatedTransitioning in Swift without Storyboards / Unwindng Segues?

ios xcode swift uiviewanimationtransition

I'm having a bit of an issue creating a custom View Controller transition in Swift. I've found this excellent tutorial http://mathewsanders.com/interactive-transitions-in-swift/ but am having trouble

displaying two or more data series (some with empty values) in one chart

c# winforms datetime merge mschart

I'm having a series with decimal values of energy consumption for every 15 minutes for one full year.This data is from the past.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.