标签:class std 处理 out end append port pen %s
批量处理PNG图片合成pdf
#/home/liq-n/桌面/png
import os
import img2pdf
def doImg2Pdf(fileName):
with open("output.pdf", "wb") as f:
#fileList = os.listdir(‘//home//Desktop//‘)
fileList = os.listdir(fileName)
pngList = []
for pngName in range(488,492):
# pngName = "//home//Desktop//%s.PNG" % str(pngName);
pngName = "%s%s.PNG" % (fileName, str(pngName));
pngList.append(pngName)
pfn_bytes = img2pdf.convert(pngList)
f.write(pfn_bytes)
print("转换完成")
doImg2Pdf(‘//home//liq-n//Desktop//‘)
标签:class std 处理 out end append port pen %s
原文地址:https://www.cnblogs.com/xzlq/p/9956982.html