UTF-8编解码器无法解码字节0xe9

时间:2019-02-27 15:59:30

标签: python python-3.x

所以看来我的代码有错误 “发生了异常:UnicodeDecodeError “ utf-8”编解码器无法解码位置3的字节0xe9:无效的连续字节” 准确地说

代码是

import smtplib
from email.mime.text import MIMEText
smtp_ssl_host = 'smtp.gmail.com'
smtp_ssl_port = 465
username = 'removed'
password = 'removed'
sender = username
targets = ["removed"]
msg = MIMEText("Test")
msg['Subject'] = "Test"
msg['From'] = sender
msg['To'] = ', '.join(targets)
server = smtplib.SMTP_SSL((smtp_ssl_host, smtp_ssl_port)
server.login(username, password)
server.sendmail(sender, targets, msg.as_string())
server.quit()

希望对其进行修复

0 个答案:

没有答案