錯誤異常slice indices must be integers or None or have

個人代碼:python

其中的content就當作字符串好了spa

content[len(content)/2:len(content)/2+5]

 

錯誤:字符串

TypeError: slice indices must be integers or None or have an __index__ methoddi

 

翻閱衆多資料發現python對於除法時候可能轉換爲了浮點數,要將裏面的「/」改成「//」就能夠運行了co

相關文章
相關標籤/搜索