convert a list [['a'], ['b']] to ['a','b']

list, nested, python, python-3.x

Solution

Try this:

a = [['a'],['b']]

a = [item for list in a for item in list]
print a
>>>['a', 'b']

Problem

Possible Duplicate: Making a flat list out of list of lists in Python In `python 3`, how can I convert a list `[['a'], ['b']]` to `['a','b']` ? I am a beginner programmer and have not been able to solve this problem myself.

Original source

Related problems