I am getting a plaintext from a webservice into an object p
and I want to store it on a .txt
file using Python.
I do something like:
with open("output","w") as t2:
t2.write(p.content)
but the following encoding issue arises:
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe8' in position 10: ordinal not in range(128)
I am on Ubuntu and PycharmIDE. How can I overcome this problem?