The World Wide Web, restored to 800 pixels of glory.
GeezerVison is showing www.runoob.com — Python 字符串翻转 | 菜鸟教程
Python3 实例
给定一个字符串,然后将其翻转,逆序输出。
执行以上代码输出结果为:
boonuR
leaf_cq
lea***[email protected]
参考方法:
# reduce + lambda 反转法 from functools import reduce str='Runoob' print(reduce(lambda x, y: y + x, str))
取消