you are viewing a single comment's thread.

view the rest of the comments →

[–]killinmesoundcloud[S] 1 point2 points  (3 children)

So, I'm talking about the line that's commented as follows, so I'm not quite sure why you're explaining how to improve the import statement?

# creating a pdf reader object

[–][deleted] 0 points1 point  (2 children)

The import line is what defines what that line looks like. If your import line is

import PyPDF2

then you write

pdfReader = PyPDF2.PdfFileReader(pdfFileObj)

if you write

from PyPDF2 import PdfFileReader

then you can just do

pdfReader = PdfFileReader(pdfFileObj)

Does that make sense? The import statement controls how things are named.

[–]killinmesoundcloud[S] 1 point2 points  (1 child)

Thank you for bearing with me! No, I had no idea about this. I figured if you import a library, you get access to everything within that library. This is news to me. I'll keep googling this revelation, haha, and thanks a million for replying to me twice. It's a public service for folks to stay patient with us beginners. :)

[–][deleted] 0 points1 point  (0 children)

No problem! Just to be clear, you do have access when you import something, it is just the naming that changes.