手机
当前位置:查字典教程网 >脚本专栏 >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 提取文件的小程序

python实现的解析crontab配置文件代码

Python学习资料

Python ORM框架SQLAlchemy学习笔记之关系映射实例

Python 深入理解yield

python用字典统计单词或汉字词个数示例

基于Python实现的扫雷游戏实例代码

学习python的几条建议分享

python实现的登录和操作开心网脚本分享

python和shell变量互相传递的几种方法

精品推荐
分类导航