0

I am using pdfplumber to take input from a pdf file. My question is how can I take from page 1-7 input using pdfplumber.

I'm using this code:

filename = "1st Year 1stSemester.pdf"
pdf = pdfplumber.open(filename)

totalpages = len(pdf.pages)
p0 = pdf.pages[0-6]

table = p0.extract_table()
table

I want to take input from page 1 to 7 I've also tried p0 = pdf.pages[0,1,2,3,6]. It also doesn't work.

Tilman Hausherr
  • 17,731
  • 7
  • 58
  • 97
NobinPegasus
  • 545
  • 2
  • 16

1 Answers1

0
for i in range (0,7):
    print(filename.pages[i].extract_text)

To show the pages, use the for loop. Input the desired pages you want to show for example in your case you want to display the pages 1-7, just like how you count an array, it start with 0 till the last page which is 7.

Roldan
  • 1
  • 1