嵌套列表转换为单列表
1.递归实现
a = [1,[2,[3],4],5]
def list_more(arg):
new_list = []
for i in arg:
if type(i) is not list:
new_list.append(i)
else:
new_list.extend(list_more(i))
return new_list
In [65]: list_more(a)
Out[65]: [1, 2, 3, 4, 5]