我在python中遇到了以下错误
UnicodeEncodeError: 'latin-1' codec can't encode character '\u018f' in position 0: ordinal not in range(256)
在试图使用pypdf2
和itertools
库文件强制破解加密的pdf时。你知道吗
这是我的密码:
奇怪的是,代码在使用不同的机器时运行良好…python版本是3.6.4,我的和我试过的机器都是。你知道吗
我试过的是:
我刚安装了pythonv3.6.4和pycharm(最新社区版本)。失败后,我尝试了anaconda(最新版本),但也失败了,于是我又回到了pythonv3.6.4
import PyPDF2 as pdf
import itertools
testFile = pdf.PdfFileReader("File01_Enc.pdf")
print(testFile.isEncrypted)
# for n in range(100001):
# if n <= 100:
# print(n)
# t = str(n)
# x = testFile.decrypt(t)
# if x == 2 or x == 1:
# print("The password is: " + str(t)
# break
pwds = itertools.combinations("0123456789", 6)
for p in pwds:
print(''.join(p))
x = testFile.decrypt(''.join(str(p)))
if x > 0:
print("The password is: " + ''.join(str(p)))
break
目前没有回答
相关问题 更多 >
编程相关推荐