如何将列表列表的列表转换为列表列表?

How to convert a list of lists of lists into a list of lists?

我有

testlist = [[["a", "b", "c"]], [["a", "b", "c"], ["a", "b", "c"]]]

想要

finalist = [["a", "b", "c"], ["a", "b", "c"], ["a", "b", "c"]]

我试过了

finalist = [[item for subsublist in sublist for item in subsublist] for sublist in testlist]

但这给了我

finalist = [["a", "b", "c"], ["a", "b", "c", "a", "b", "c"]]

我根据您的输入试过了。我认为您只需要担心子列表并解压缩它们即可。您的方法是首先展平子列表,这就是最后一部分错误的原因

[l for s in testlist for l in s]