UI自动化邮件发送:UnicodeDecodeError: 'gbk' codec can't decode byte 0xaa in position 213: illegal multibyte sequence问题

原代码:
with open('D:\zhang2.html','r') as f:
content = f.read()
part1 = MIMEText(content,'html','utf-8')

修改后的代码:
with open('D:\zhangshuai2.html','r',encoding="utf-8") as f:
content = f.read()
#设置html格式参数
part1 = MIMEText(content,'html','utf-8')
posted @ 2022-03-18 15:30  张丶先森  阅读(42)  评论(0)    收藏  举报