python PyPDF2 程序模块基础功能测试

from PyPDF2 import PdfFileWriter, PdfFileReader

output = PdfFileWriter()
input1 = PdfFileReader(open("C:\\Users\\laiwu\\Desktop\\rmrb\\rmrb2020080101.pdf", "rb"))

# print how many pages input1 has:

print ("document1.pdf has %d pages." % input1.getNumPages())

输出结果:

这里需要强调的是:

PyPDF2 模块自带基础功能程序案例 https://github.com/mstamy2/PyPDF2/blob/master/Sample_Code/basic_features.py

 但其中因为python程序升级的原因

案例程序中:

1、print  函数忘记  加括号。

2、子文件夹需要用“\\”来分隔。

猜你喜欢

转载自blog.csdn.net/jidawanghao/article/details/108213115