链接: https://pan.baidu.com/s/1jJJU4Do 密码: z5xe
li = [1, [2, [3, [4, 5]]], 6, [7, 8], 9]
print(li)
for x in li:
if type(x) == list:
for y in x:
if type(y) == list:
for z in y:
if type(z) == list:
for w in z:
if type(w) == list:
pass
else:
print(w)
else:
print(z)
else:
print(y)
else:
print(x)
# 定義遞歸函數
def unlist(n):
for x in n:
if type(x) == list:
unlist(x)
else:
print(x)
unlist(li)