我不断收到错误“IndexError:列表索引超出范围”
不知道我做错了什么它适用于一对夫妇运行一个错误我唯一能想到的是我得到的名字对于变量来说太长了
mylist = [x +'.mp3' for x in re.findall(r'file=(.*?).mp3',the_webpage)]
#Remove Duplicates
if mylist:
mylist.sort()
last = mylist[-1]
for i in range(len(mylist)-3, -1, -1):
if last == mylist[i]:
del mylist[i]
else:
last = mylist[i]
print " "
#takes the quotes out of the string
#ti = titl1[0]
n1 = titl1[0]
n2 = song1[0]
#sg = song1
sname = "".join(tuple(n1 + "-" + n2 + ".mp3"))
print sname
url = mylist[0]
结果
Traceback (most recent call last):
File "grub.py", line 59, in <module>
url = mylist[0]
IndexError: list index out of range