递归
def sum(n,deep):
sums = 0
# print(deep)
for i in n:
if isinstance(i, list):
sums += sum(i,deep+1)
if isinstance(i, int):
sums += deep
return sums
a = eval(input())
j = 0
print(sum(a,1))
标签:return,个数,sum,sums,deep,列表,sdut,print,isinstance
来源: https://www.cnblogs.com/kingwz/p/16328102.html