#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 13 15:54:02 2019
@author: xinran
html文件转pdf
"""
import pdfkit
htmlpath='/Users/xinran/Downloads/Document/答案代码_练习07中国城市资本流动问题探索.html'
pdfpath='/Users/xinran/Downloads/Document/答案代码_练习07中国城市资本流动问题探索.pdf'
config = pdfkit.configuration(wkhtmltopdf='/usr/local/bin/wkhtmltopdf')
# print(htmlpath)
# name = name.replace('html', 'pdf')
# os.chdir(savepath)
pdfkit.from_file(htmlpath, pdfpath, configuration=config)
print('test!')
来源:CSDN
作者:soda東風
链接:https://blog.csdn.net/weixin_42568012/article/details/103712856