import pdfkit
import requests
import os
url='https://www.cnblogs.com/yychuyu/p/13619923.html'
a=requests.get(url)
b=open(r'./良许Linux.html','w',encoding="utf-8")
b.write(a.text)
b.close()
# a=pdfkit.configuration(wkhtmltopdf="C:/Program Files/wkhtmltopdf/bin/wkhtmltopdf.exe")
try:
if not os.path.exists('./良许Linux.pdf'):
pdfkit.from_file('./良许Linux.html', './良许Linux.pdf')
else:
print("文件已存在!")
except:
pass