I am attempting to write a pretty printed email to a .txt file so i can better view what I want to parse out of it.
Here is this section of my code:
resu
You are missing the brackets at the end of f.close()
.
You need to invoke the close method to commit the changes to the file. Add ()
to the end:
f.close()
Or even better would be to use with:
with open("da_email.txt", "w") as f:
f.write(pretty_email)
which automatically closes the file for you