How to extract text from pdf in Python 3.7

后端 未结 10 1183
后悔当初
后悔当初 2020-12-29 10:19

I am trying to extract text from a PDF file using Python. My main goal is I am trying to create a program that reads a bank statement and extracts its text to update an exce

10条回答
  •  时光说笑
    2020-12-29 10:58

    import PyPDF2
    pdf-file = open('January2019.pdf', 'rb')
    pdfReader = PyPDF2.PdfFileReader(pdf-file)
    count = pdfReader.numPages
    for i in range(count):
        page = pdfReader.getPage(i)
        print(page.extractText())
    

提交回复
热议问题