>>> s = 'hello world python'
>>> s1 = s[::-1]
>>> s1
'nohtyp dlrow olleh'
>>> s2 = s.split(' ')
>>> s2.reverse()
>>> s2
['python', 'world', 'hello']
>>>
>>> s = 'hello world python'
>>> s1 = s[::-1]
>>> s1
'nohtyp dlrow olleh'
>>> s2 = s.split(' ')
>>> s2.reverse()
>>> s2
['python', 'world', 'hello']
>>>
本文标题:python 字符串翻转| 单词翻转
本文链接:https://www.haomeiwen.com/subject/vtrfyxtx.html
网友评论