Answers for "flatten an array to list python"

1

python flatten array of arrays

import numpy as np
out = np.concatenate(input_list).ravel()
Posted by: Guest on July-29-2021
13

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)
Posted by: Guest on August-12-2021

Python Answers by Framework

Browse Popular Code Answers by Language