One line one word.
But this is actually the solution:
But this is actually the solution:
for word in liDict: if pdfReader2.decrypt(word) == 1: print('The correct PWD as upper case: ' + word) break elif pdfReader2.decrypt(word.lower()) == 1: print('The correct PWD as lower case: ' + word) breakMy mistake was that I put print statement after break.