论文爬取 pdf文件爬取(四)

写入pdf文件

现在已经到了最后的部分

其中直接将上一部分请求的pdf内容保存到自己的文件路径中就可以了

if not os.path.exists(PDF_path):
with open(PDF_path,'wb') as f:
print('正在抓取:'+title)
f.write(response.content)
# time.sleep(1)
f.close()
else:
print('已下载: '+title)


posted @ 2021-05-15 21:52  黄某人233  阅读(59)  评论(0编辑  收藏  举报