Receiving email with .csv attachment with google app engine
I have been able to read em开发者_StackOverflow社区ails, and I can see the attachments, but they don't come in as .csv data. I guess it is an 'EncodedPayload' type?
The following code:
for filename, content in attachments:
logging.info("filename: " + filename)
fileReader = csv.reader(content.split("\n"))
gave me this error:
'EncodedPayload' object has no attribute 'split'
How do I parse a csv file given an EncodedPayload ?
call decode()
on your content:
fileReader = csv.reader(content.decode())
精彩评论