python处理多层嵌套列表

def print_lol(the_list):
    for each_item in the_list:
        if isinstance(each_item,list):
            print_lol(each_item)
        else:
            print(each_item)
movies=["the boy","the life of Brain",["we",["sers"],"Byes"]]
movies.append("python");
movies.insert(1,"yyy");
print_lol(movies)           
            

 

posted @ 2013-03-04 14:30  ilxx1988  阅读(350)  评论(0编辑  收藏  举报