方法一,使用[::-1]:
s = 'python'
print s[::-1]

方法二,使用reverse()方法:
l = list(s)
l.reverse()
print ''.join(l)
输出结果:
nohtyp
nohtyp

点赞(76)

评论列表共有 0 条评论

立即
投稿
返回
顶部