最近运行课件代码,发现pdf文件读取部分的函数失效。这里找到读取pdf文件的可运行代码,为了方便后续学习使用,我已将pdf和docx读取方法封装成pdfdocx包。
pdfdocx
只有简单的两个读取函数
- read_pdf(file)
- read_docx(file)
file为文件路径,函数运行后返回file文件内的文本数据。
安装
pip install pdfdocx
使用
读取pdf文件
from pdfdocx import read_pdf
p_text = read_pdf('test/data.pdf')
print(p_text)
Run
这是来⾃pdf⽂件内的内容
from pdfdocx import read_docx
d_text = read_pdf('test/data.docx')
print(d_text)
Run
这是来⾃docx⽂件内的内容
如果
如果您是经管人文社科专业背景,编程小白,面临海量文本数据采集和处理分析艰巨任务,可以参看《python网络爬虫与文本数据分析》视频课。作为文科生,一样也是从两眼一抹黑开始,这门课程是用五年时间凝缩出来的。自认为讲的很通俗易懂o( ̄︶ ̄)o,
- python入门
- 网络爬虫
- 数据读取
- 文本分析入门
- 机器学习与文本分析
- 文本分析在经管研究中的应用
感兴趣的童鞋不妨 戳一下《python网络爬虫与文本数据分析》进来看看~
更多
-
公众号:大邓和他的python
Metadata
Release files for pdfdocx 1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pdfdocx-1.7-py3-none-any.whl | Python 3 | none | any | Details for pdfdocx-1.7-py3-none-any.whl |
Release files / pdfdocx-1.7-py3-none-any.whl
| Download URL | pdfdocx-1.7-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e5e325d99177de54ff9eeef7e0be6cd4de5e12b9496c327670e559775f7119cc
|
|
BLAKE2b-256 checksum How to use checksums |
80ecaebe998b9d19edcab9cb2f03cf427a73dc4018b5927d8035f64bddb9b343
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Security for pdfdocx 1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.