Python 字符串反转 1. Python 字符转切片实现 Python代码 name = tramp print name[::-1]登录后复制2. Python 递归实现 Python代码 def reverse(aStr): """reverse a string""" if len(aStr) == 0: return aStr newStr = reverse(aStr[1:]) + aStr[0] return newStr登录后复制