【发布时间】:2021-08-05 19:32:50
【问题描述】:
我正在用 Python 3 编写一个代码,它接收一个 XML 文件并从链接中提取文本(目前正在尝试使用 PyPDF2)。我已经编写了这个函数来尝试这样做:
def DataExtraction(aspects_link):
#aspects_link is a list that has all the links from the XML file
for i in aspects_link:
reader = PyPDF2.PdfFileReader(aspects_link[i])
#extracting the pages
reader.getPage().extractText()
我收到错误 Parameter 'pageNumber' unfilled 由于要提取的链接很多,而且我不知道每个链接可能有多少页,我想知道是否有一种方法可以编写代码以提取每个页面而无需我指定有多少。
【问题讨论】:
标签: python python-3.x xml-parsing data-extraction