>>> s='hello,world'
>>> s[::-1] #分片将会从右到左进行
'dlrow,olleh'
>>> s[5:1:-1]
',oll'
>>> s[5:1]
''
>>>
>>> s='hello,world'
>>> s[::-1] #分片将会从右到左进行
'dlrow,olleh'
>>> s[5:1:-1]
',oll'
>>> s[5:1]
''
>>>
转载于:https://www.cnblogs.com/wawawawa-briefnote/p/8678821.html