您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

Python 字符串反转

2024/3/4 23:10:10发布23次查看
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
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product