在这里,我尝试读取一些邮箱文件,但在ret
def readFiles(path):
for root, dirnames, filenames in os.walk(path):
for filename in filenames:
path = os.path.join(root, filename)
inBody = False
lines = []
f = io.open(path, 'r', encoding='latin1')
for line in f:
if inBody:
lines.append(line)
elif line == '\n':
inBody = True
f.close()
message = '\n'.join(lines)
yield path, message
这是我使用的路径格式。我也尝试过从此处删除html。
readFiles('/emails/spam/*.html')