“Поиск слова в PDF с помощью Python” Ответ

Поиск слова в PDF с помощью Python

import PyPDF2
import re

# Open the pdf file
object = PyPDF2.PdfFileReader(r"C:\TEST.pdf")

# Get number of pages
NumPages = object.getNumPages()

# Enter code here
String = "Enter_the_text_to_Search_here"

# Extract text and do the search
for i in range(0, NumPages):
    PageObj = object.getPage(i)
    Text = PageObj.extractText()
    if re.search(String,Text):
         print("Pattern Found on Page: " + str(i))
Long Llama

Поиск слова в PDF с помощью Python

import PyPDF2
import re

# Open the pdf file
object = PyPDF2.PdfFileReader(r"C:\TEST.pdf")

# Get number of pages
NumPages = object.getNumPages()

# Enter code here
String = "Enter_the_text_to_Search_here"

# Extract text and do the search
for i in range(0, NumPages):
    PageObj = object.getPage(i)
    Text = PageObj.extractText()
    if re.search(String,Text):
         print("Pattern Found on Page: " + str(i))
ishwar sangolli

Ответы похожие на “Поиск слова в PDF с помощью Python”

Вопросы похожие на “Поиск слова в PDF с помощью Python”

Больше похожих ответов на “Поиск слова в PDF с помощью Python” по Python

Смотреть популярные ответы по языку

Смотреть другие языки программирования