fp.write(finalHTML)
File "C:\Users\ME\AppData\Local\Programs\Python\Python38-32\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 108308-108313: character maps to <undefined>
代码
19: today = datetime.date.today()
date_time_text = "<h3 style='text-align:center;'>" + today.strftime("Compiled on %d, %b %Y") + "</h3>"
42: finalHTML = "<body>" + book_title_text + date_time_text + "<br/><br/><br/>" + "</body>"
for readyEntry in finalEntriesInHTML:
finalHTML = finalHTML + readyEntry.HTML + "<mbp:pagebreak/>"
fp = open(os.getcwd() + "/r2K-result.htm", "w")
fp.write(finalHTML)
fp.close()
idk 为什么,但是 qhwn 它是从 reddit 中提取的,它的字符编码错误:/
冉冉说
相关分类