种心收默

pthon 反转嵌套的list

def rev_recursive(li):
    try:
        iterator = iter(li)
    except TypeError:
        return li
    l = []
    for item in iterator:
        item = rev_recursive(item)
        l = [item] + l
    return l

 

posted on 2015-12-24 16:58  samcao  阅读(327)  评论(0)    收藏  举报

导航