[英]argument of type 'int' is not iterable - Python error while writing to another file
我正在打开一个文件并检查该文件中是否包含“Error”关键字。 如果找到,我将错误内容作为附件写为 email 发送。
with open(self.filePath, 'rb') as content_file:
content = content_file.readline()
content = [i for i in content if "Error" in i]
content = "\n".join(content)
self.msg.add_attachment(content, maintype='text', subtype='plain', filename=self.filePath.split('/')[-1])
但是我收到一个错误
argument of type 'int' is not iterable
请告诉我如何处理这个问题。 我尝试添加b"Error"
,但这也引发了错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.