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,7,[2,[[[[[[5]]]]]]]]]]]]],4]] move_list(s) print(D)
去掉多层嵌套列表
猜你喜欢
转载自www.cnblogs.com/aj-AJ/p/11534028.html
今日推荐
周排行