通过本文主要向大家介绍了python字符串插入字符,python字符串处理,python 字符串,python 字符串转数字,python 字符串截取等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
方法一,使用[::-1]:
s = 'python'
print s[::-1]
方法二,使用reverse()方法:
l = list(s)
l.reverse()
print ''.join(l)
输出结果:
nohtyp
nohtyp
</div>
s = 'python'
print s[::-1]
方法二,使用reverse()方法:
l = list(s)
l.reverse()
print ''.join(l)
输出结果:
nohtyp
nohtyp
</div>

