def reverse_s(s): if len(s) <= 1: return s else: #如果只写s[1:],只能返回n, return reverse_s(s[1:]) + s[0]s = "ilikepython"print reverse_s(s)