我想問有關反轉str的問題
str="play"
print str[::-1] #yalp
print str[0:len(str):-1] #none
print str[len(str):0:-1] #yal
print str[len(str)::-1] #yalp
print str[-1:-5:-1] #yalp
如果step為正[::1],start默認為0而end默認為len(str)
我不知道為負[::-1]的第一個空白start和第二個空白end會帶入什麼
一開始以為會等於這個str[0:len(str):-1],但不是
我想請問step為負的時候,前面兩個默認是什麼
我爬了一下 相關的文章是
https://www.ptt.cc/bbs/Python/M.1291617432.A.045.html