#!/usr/bin/python
# -*- coding: UTF-8 -*-



#递归
def print_lol(the_list):
    for each_item in the_list:
        if isinstance(each_item,list):  #判断each_item 是否为列表,如果是则递归
            print_lol(each_item)
        else:
            print(each_item)

mo=[['a','b','c'],'c','d','s',[1,2,3,4],'e','s',['q','w','r']]

print_lol(mo)

结果:

>>>
a
b
c
c
d
s
1
2
3
4
e
s
q
w
r
>>>

posted on 2013-08-31 00:34  神·鲸落  阅读(161)  评论(0编辑  收藏  举报