📜  如何在python代码示例中展平列表列表

📅  最后修改于: 2022-03-11 14:45:40.280000             🧑  作者: Mango

代码示例6
# 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)