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 连接字符串(join %)