【问题标题】:how to get list of table objects (cells) from Camelot如何从 Camelot 获取表格对象(单元格)列表
【发布时间】:2021-06-21 13:56:50
【问题描述】:
【问题讨论】:
标签:
python-3.x
pdf
python-camelot
【解决方案1】:
你对table.cells感兴趣
使用示例:
import camelot
tables=camelot.read_pdf('YOUR-PDF-FILEPATH',pages='all')
print(tables[0].cells)
输出:
[[<Cell x1=218.65 y1=698.47 x2=267.14 y2=722.23>,
<Cell x1=267.14 y1=698.47 x2=296.18 y2=722.23>,
<Cell x1=296.18 y1=698.47 x2=324.98 y2=722.23>,
<Cell x1=324.98 y1=698.47 x2=353.78 y2=722.23>,
<Cell x1=353.78 y1=698.47 x2=382.83 y2=722.23>,
<Cell x1=382.83 y1=698.47 x2=411.63 y2=722.23>,
<Cell x1=411.63 y1=698.47 x2=440.43 y2=722.23>,
<Cell x1=440.43 y1=698.47 x2=469.23 y2=722.23>,
<Cell x1=469.23 y1=698.47 x2=500.91 y2=722.23>,
<Cell x1=500.91 y1=698.47 x2=529.96 y2=722.23>],...]
单元格属性列表(由dir(tables[0].cells[0][0])获取):
bottom、bound、hspan、lb、left、lt、rb、right、rt、text、top、vspan、x1、x2、y1、y2。
您可以尝试它们并与它们一起玩。