手机
当前位置:查字典教程网 >脚本专栏 >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程序设计入门(4)模块和包

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

python 提取文件的小程序

Python学习资料

Python 深入理解yield

python在windows下实现备份程序实例

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

python读取注册表中值的方法

详解Python中的__init__和__new__

精品推荐
分类导航