Your belief is correct. Both are lists.
When I try to split liDict get this:
Now I removed unnecessary list:
When I try to split liDict get this:
Error:AttributeError: 'list' object has no attribute 'split'
Suggestion how to do a split is appreciated.Now I removed unnecessary list:
import PyPDF2 pdfFile = open('reverse.pdf', 'rb') pdfReader = PyPDF2.PdfFileReader(pdfFile) pdfWriter = PyPDF2.PdfFileWriter() for pageNum in range(pdfReader.numPages): pdfWriter.addPage(pdfReader.getPage(pageNum)) pdfWriter.encrypt('inside') resultPdf = open('encryptedreverse.pdf', 'wb') pdfWriter.write(resultPdf) resultPdf.close() helloDict = open('dictionary.txt') helloDictCont = helloDict.read().splitlines() PdfFile2 = open('encryptedreverse.pdf', 'rb') pdfReader2 = PyPDF2.PdfFileReader(PdfFile2) print(pdfReader2.isEncrypted) for word in helloDictCont: if pdfReader2.decrypt(word) == 1: break print(word) elif pdfReader2.decrypt(word.lower()) == 1: break print(word)