小甲鱼网易云音乐那个代码怎么修改为按不同的歌名保存文件
with open("hot_comments.txt","w",encoding="utf-8")as file:for each in hot_comments:
file.write(each['user']['nickname']+':\n\n')
file.write(each['content']+'\n')
file.write("------------------------------------\n")
怎么修改为按输入的歌名保存文件,例如我现在爬取的是丑八怪的评论,那我想把文件名保存为丑八怪.txt;再爬取演员,保存为演员.txt with open(接受歌名的变量名称+".txt","w",encoding="utf-8")as file:
页:
[1]