代码改变世界

随笔档案-2017年08月

去除多层list中嵌套的list,形成新的列表

2017-08-19 16:13 by hdwen, 1955 阅读, 收藏,
摘要: D = []def move_list(a): for i in a : if type(i) != list: D.append(i) else: move_list(i)s=[1,[12,[1,[1,23,4,[1,2,[3]]]]],[3,[1,[2,645,[3,5,[456,[4,[45, 阅读全文