I'm trying to print the content of an url as string and I wrote this code to do it
import requests
r = requests.get('http://example.com')
print r.text
but in this way I get this error:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 319-326: ordinal not in range(128)
so I tried to convert in a json string in this way:
print json.dumps(r.text)
The content is printed as string, but I don't think that it's the correct way to do it. Furthermore i see some characters like this
ud83c\uddee\ud83c\uddf9\ud83c\uddea\ud83c\uddfa
and I supposed they are some emoji, so I try to encoding the string in utf-8, but nothing. How can I print the content of the url with the emoji in a correct way ? Thanks