python - TypeError:无法将 int 连接到字节
问题描述
运行此代码以阅读电子邮件:
if uid > uid_max:
result, data = server.uid('fetch', uid, '(RFC822)') # fetch entire message
msg = email.message_from_string(data[0][1])
我收到此错误:
TypeError: can't concat int to bytes
如何解决这个问题?
解决方案
我有同样的问题,我通过用str(uid)替换uid解决了它
result, data = server.uid('fetch', str(uid), '(RFC822)')
再见
推荐阅读
- python - 带有 Python CGI 的 HTML(如果有)
- amazon-web-services - lambda函数接收到的事件对象为空
- google-apps-script - 使用自定义按钮和链接创建对话框
- python - Python selenium xpath 使用包含和不包含
- python - sumifs 解决给定问题的 python 等价物是什么
- javascript - 如何防止 expo 使用 devDependencies?
- azure - 使用 Pycharm 登录 Azure CLI
- kubernetes - 如何本地访问部署在 GCP kubernetes 上的 influx db
- excel - Excel - 提取分隔字符串中的第一个字母
- r - python 3.6中的Rpy2有时工作有时不工作