Python - How to convert utf literal such as '\xc3\xb6' to the letter ö
问题 I am trying to convert an encoded url with german Umlaute into a string with those Umlaute. Here is an example of an encoded string = 'K%C3%B6nnen'. I would like to convert it to 'Können' When I use urllib.unquote(a) I get this returned: 'K\xc3\xb6nnen' \xc3\xb6 I found out is a utf literal. How can I convert this to an ö ? I find that if I use the print function it converts it correctly, but I cannot figure out how to get a function to return this value? Any ideas? 回答1: With decode("utf-8")