Python UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\xb0′ in position 79

##Sometimes you are trying to parse string to string like

str(object.attribute)

## That could have this problem because is trying to encode to ascii while not all is ascii, just delete that parsing

object.atribute

##sometimes you need to explicit ignore the encoding

my_string.encode('ascii', 'ignore')
my_string.encode('ascii', 'ignore').decode('ascii')
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s