#python#用python试了下递归

erlang只能递归,所以先用python练练手:

如果不用异常,会弹出一堆恶心的错误。所以。。。

def cut(a):
    try:
        out = a.pop()
        print out
        cut(a)
    except Exception,e:
        print 'this list is empty'



你可能感兴趣的:(python)