Skip to content

Commit

Permalink
DOC: Use enumerate in extract example (py-pdf#2727)
Browse files Browse the repository at this point in the history
  • Loading branch information
j-t-1 authored Jun 27, 2024
1 parent 160ab38 commit 15e3a5d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions docs/user/extract-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ from pypdf import PdfReader
reader = PdfReader("example.pdf")

page = reader.pages[0]
count = 0

for image_file_object in page.images:
for count, image_file_object in enumerate(page.images):
with open(str(count) + image_file_object.name, "wb") as fp:
fp.write(image_file_object.data)
count += 1
```

# Other images
Expand Down

0 comments on commit 15e3a5d

Please sign in to comment.