#读文件
with open("xiaoqu_url.txt", "r+", encoding="utf-8") as f:
content=f.read()
url_list=content[:-1].split(',')#取出来的元素会根据逗号分割成一个列表形式
#写文件
with open("xiaoqu_url.txt", "a+", encoding="utf-8") as f:
f.write(url + ",")
python的txt文件存取
最新推荐文章于 2023-02-25 09:02:44 发布