This is my code:
#!C:/Python27/python # -*- coding: utf-8 -*- import requests from bs4 import BeautifulSoup import urllib2 import sys import urlparse import
Try to normalize the string and then ASCII encode it ignoring errors.
ASCII
# -*- coding: utf-8 -*- from unicodedata import normalize string = 'úäô§' if isinstance(string, str): string = string.decode('utf-8') print normalize('NFKD', string).encode('ASCII', 'ignore') >>> uao