Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to flatten list of lists in python

# if your list is like this
l = [['Adela', 'Fleda', 'Owen', 'May', 'Mona', 'Gilbert', 'Ford'], 'Adela']

# then you 
a = []
for i in l:
    if type(i) != str:
        for x in i:
            a.append(x)
    else:
        a.append(i)
 
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #flatten #list #lists #python
ADD COMMENT
Topic
Name
3+7 =