手机
当前位置:查字典教程网 >脚本专栏 >python >Python 字符串中的字符倒转
Python 字符串中的字符倒转
摘要:方法一,使用[::-1]:s='python'prints[::-1]方法二,使用reverse()方法:l=list(s)l.revers...

方法一,使用[::-1]:

s = 'python'

print s[::-1]

方法二,使用reverse()方法:

l = list(s)

l.reverse()

print ''.join(l)

输出结果:

nohtyp

nohtyp

【Python 字符串中的字符倒转】相关文章:

Python程序设计入门(5)类的使用简介

Python类的基础入门知识

Python 深入理解yield

python 提取文件的小程序

Python程序设计入门(4)模块和包

Python牛刀小试密码爆破

python中stdout输出不缓存的设置方法

Python字符转换

python局部赋值的规则

python读取注册表中值的方法

精品推荐
分类导航