第二章《共享你的代码》
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)