1.注释
2.缩进
代码:
def print_lol(the_list,level=0):
for each_item in the_list:
if isinstance(each_item,list):
print_lol(each_item,level+1)
else:
if ind:
for tab_stop in range(level):
print("\t",end=‘‘)
print(each_item)
3.增加缺省默认值:
def print_lol(the_list,ind=False,level=0):
for each_item in the_list:
if isinstance(each_item,list):
print_lol(each_item,ind,level+1)
else:
if ind:
for tab_stop in range(level):
print("\t",end=‘‘)
print(each_item)
时间: 2024-12-29 12:02:39