我编写了一个python代码,它给出了以下错误"IndexError: string index out of range"
请告诉我如何纠正这个错误。你知道吗
actuallink = 'http://www.exxonmobilperspectives.com'
slashcounter = 0
indexslash = 0
while slashcounter < 3:
if(actuallink[indexslash] == '/'):
slashcounter = slashcounter + 1
indexslash = indexslash + 1
PLink = actuallink[:indexslash - 1]
另外,当我改变链接到其他任何东西,它的作品完美
试试这个:
结果是:
像这样的
相关问题 更多 >
编程相关推荐