singer=[] for j inrange(100): singer.append([0]*2) k=0 for key in song_list: url="https://music.163.com"+song_list[i][0] r=requests.get(url,headers=kv,timeout=30) htm=r.text reg_list2='<p class="des s-fc4">歌手:<span title="(.*?)">' reg_list2=re.compile(reg_list2,re.S) s=re.findall(reg_list2,htm)
j=0 while j<k: if s!=singer[j][0]: j+=1 else: singer[j][1]+=1 break if j==k: if s!=singer[j][0]: k+=1 singer[k][0]=s singer[k][1]+=1 else: singer[j][1]+=1 j+=1 i=i+1