标签:字符串 reverse ever int return 问题 turn print 一个
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)
标签:字符串 reverse ever int return 问题 turn print 一个
原文地址:http://www.cnblogs.com/hizf/p/7434760.html