python 递归一行实现字符串反转

def myreverse2(s):
    return "" if not s or len(s) == 0 else myreverse2(s[1:]) + s[0]

s2 = "1234567899988877654321"
print(myreverse2(s2))

posted on 2019-07-22 16:12  子狼  阅读(1009)  评论(0编辑  收藏  举报

导航