Converting list of lists / nested lists to list of lists without nesting
问题 I want to convert my list of lists and within these lists there are list into only list of lists. For example: My code: a = [[], [], [['around_the_world']], [['around_the_globe']], [], [], [], []] aaa = len(a) aa = [[] for i in range(aaa)] for i, x in enumerate(a): if len(x) != 0: for xx in x: for xxx in xx: aa[i].append(xxx) print(aa) Currently: a = [[], [], [['around_the_world']], [['around_the_globe']], [], [], [], []] to expected: [[], [], ['around_the_world'], ['around_the_globe'], [], [