【PYTHON,PDF】1.利用python.pypdf2 进行文字表格提取

0.安装模块

window: pip insta pypdf2
	     pip install pdfplumber
mac:    pip3 insta pypdf2
	     pip3 install pdfplumber

若错误可

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pdfplumber

1.提取pdf文字内容

提取一页:

import pdfplumber

with pdfplumber.open("1.pdf") as pdf:
	page1 = pdf.pages[0]
	print(page1.extract_text())
附件 1 2020 年第 33 届国际青年物理学家锦标赛(IYPT2020)赛题
1. Invent Yourself  the relevant parameters.
Design an instrument for measuring  3.  摇摆的声管
current using its heating effect. What are  声管是一种玩具,由波纹塑料管
the accuracy, precision and limits of the  组成,你可以旋转声管产生声音。研究
method?  这些玩具发出的声音的特性,以及它
1.  你来发明  们如何受到相关参数的影响。
设计一种利用热效应测量电流的
仪器。该方法的准确度、精密度和局限 4. Singing Ferrite
性是什么?  Insert a ferrite rod into a coil fed
  from  a  signal  generator.  At  some
2. Inconspicuous Bottle  frequencies the rod begins to produce a
Put a lit candle behind a bottle. If  sound. Investigate the phenomenon.
you blow on the bottle from the opposite  4. “歌神”铁氧体
side, the candle may go out, as if the  将铁氧体棒插入信号发生器供电
bottle was not there at all. Explain the  的线圈中。在某些频率下,铁氧体棒开
phenomenon.  始发出声音。研究这一现象。
2.  不起眼的瓶子
将点燃的蜡烛放在瓶子后面。如 5. Sweet Mirage
果你从蜡烛的对面吹瓶子,蜡烛同样 Fata Morgana is the name given to a
可能熄灭,好像瓶子根本不在那里。解 particular  form  of  mirage.  A  similar
释这个现象。  effect can be produced by shining a laser
  through a fluid with a refractive index
3. Swing Sound Tube  gradient. Investigate the phenomenon.
A Sound Tube is a toy, consisting of  5.  甜蜜的海市蜃楼
a corrugated plastic tube, that you can  法塔莫干纳是一种特殊形式的海
spin around to produce sounds. Study the  市蜃楼的名字。而使用激光照射具有
characteristics of the sounds produced by  折射率梯度的流体时,也会产生类似
such toys, and how they are affected by  的效果。研究这一现象。

提取全部文字:

import pdfplumber

with pdfplumber.open("1.pdf") as pdf:
for pages in pdf.pages:
		print(pages.extract_text())
附件 1 2020 年第 33 届国际青年物理学家锦标赛(IYPT2020)赛题
1. Invent Yourself  the relevant parameters.
Design an instrument for measuring  3.  摇摆的声管
current using its heating effect. What are  声管是一种玩具,由波纹塑料管
the accuracy, precision and limits of the  组成,你可以旋转声管产生声音。研究
method?  这些玩具发出的声音的特性,以及它
1.  你来发明  们如何受到相关参数的影响。
设计一种利用热效应测量电流的
仪器。该方法的准确度、精密度和局限 4. Singing Ferrite
性是什么?  Insert a ferrite rod into a coil fed
  from  a  signal  generator.  At  some
2. Inconspicuous Bottle  frequencies the rod begins to produce a
Put a lit candle behind a bottle. If  sound. Investigate the phenomenon.
you blow on the bottle from the opposite  
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值