python操作word、pdf問題彙總

七刀發表於2020-11-05

問題1. pyPdf2操作pdf出現:

'latin-1' codec can't encode characters in position 8-9: ordinal not in range(256)

錯誤詳情

Exception Type:UnicodeEncodeError
Exception Value:
'latin-1' codec can't encode characters in position 8-9: ordinal not in range(256)
Exception Location:H:\program_w\code\python\venv\lib\site-packages\PyPDF2\utils.py, line 238, in b_

 解決方法:

 在相應的檔案中修改即可:即是錯誤提示中的 Exception Location:H:\program_w\code\python\venv\lib\site-packages\PyPDF2\utils.py, line 238, in b_ 

  這個檔案中的這一行latin-1修改為utf-8 即可!

   

相關文章