So, I'm a new programmer python is my first language. I'm trying to create a program to randomly open a pdf from a directory and read/display one page. Anyway thats what I got so far. I'm just wondering if theres a more efficient way to write this. Any advice?
import os, random, Pdf from Pdf import PdfFileReader, PageObject b = random.choice(os.listdir("/home/illman/reading/books/PDF")) Pdf_toRead = PdfFileReader(open(b, 'r')) page_one = pdf_toRead.getPage(random.randrange(0, 10000))