手机
当前位置:查字典教程网 >脚本专栏 >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读取注册表中值的方法

Python字符转换

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

Python写的贪吃蛇游戏例子

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

Python 深入理解yield

Python 学习笔记

Python 元组(Tuple)操作详解

详解Python中的__init__和__new__

精品推荐
分类导航