音乐
import requests
url="https://m801.music.126.net/20240308190216/4cddc4c882388837b381cc0022f7deb2/jdyyaac/obj/w5rDlsOJwrLDjj7CmsOj/14096408893/d114/8138/3ff0/26ccf3485b84b4d4aa052cd527d35d20.m4a"
headers = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"
}
response = requests.get(url, headers = headers)
content = response.content
with open("delete.mp3","wb") as file:
file.write(content)
文本
使用csv文本存储
with open("data.csv","w",encoding = "utf-8") as file:
csv_writer = csv.writer(file)
csv_writer.writerows(data)
csv_writer.writerows([[9,8,7,6]])
w: 写
a: 追加