Linked Questions
69 questions linked to/from Convert a Unicode string to a string in Python (containing extra symbols)
9 votes
1 answer
8k views
Is there a way to convert unicode to the nearest ASCII equivalent? [duplicate]
I will give the example from Turkish, for example "şğüı" becomes "sgui" I'm sure each language has it's own conversion methods, sometimes a character might be converted to multiple ASCII characters, ...
-3 votes
2 answers
1k views
How to convert json unicode response to string in python? [duplicate]
I have a json response that looks like: response ={u'connections': [{u'pair': [u'5', u'14'], u'routes': [[u'5', u'6', u'13', u'14'], [u'5', u'7', u'10', u'4', u'14']]}], u'succeeded': ...
-2 votes
1 answer
2k views
How to convert unicode that I'm getting with BeautifulSoup [duplicate]
I am trying to get Premier league table with this code: from bs4 import BeautifulSoup import requests url ="http://www.premierleague.com/en-gb.html" r = requests.get(url) soup = BeautifulSoup(r....
0 votes
1 answer
510 views
How to convert a unicode character "\U0001d403" to Escape sequence in python? [duplicate]
It is a Mathematical Alphanumeric Symbols ( capital D ) and I just want to convert into simple English letter ( Capital D ). Like, \U0001d403 => \uxxxx. I am not familiar with decode-encoding ...
1 vote
0 answers
100 views
How to convert non-ASCII in filename [duplicate]
I have a film title like so: México How would I convert this into a cleaned filename? Mexico Basically, I need to remove all non-ASCII characters from a name and replace it with its normalized ...
-4 votes
1 answer
77 views
How to clean text in Python [duplicate]
I have many articles like the following: "Ad Darbāsīyah, Al Ḩasakah, Al Mālikīyah, Al Qāmishlī, Al-Malikiyah District, Amude, Al-Thawrah District, Ar Raqqah, Ar-Raqqah District, Ath Thawrah, Tall ...
0 votes
1 answer
68 views
Changing string to ascii in python [duplicate]
I need to convert word name = 'Łódź' to ASCII characters output: 'Lodz' I can't import any library like unicodedata. I need to do it in clear python. I've tried to encode than decode and nothing ...
255 votes
8 answers
414k views
Writing Unicode text to a text file? [duplicate]
I'm pulling data out of a Google doc, processing it, and writing it to a file (that eventually I will paste into a Wordpress page). It has some non-ASCII symbols. How can I convert these safely to ...
235 votes
9 answers
123k views
case-insensitive list sorting, without lowercasing the result?
I have a list of strings like this: ['Aden', 'abel'] I want to sort the items, case-insensitive. So I want to get: ['abel', 'Aden'] But I get the opposite with sorted() or list.sort(), because ...
78 votes
8 answers
151k views
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in position 3 2: ordinal not in range(128)
I am parsing an XSL file using xlrd. Most of the things are working fine. I have a dictionary where keys are strings and values are lists of strings. All the keys and values are Unicode. I can print ...
88 votes
3 answers
26k views
Where is Python's "best ASCII for this Unicode" database? [closed]
I have some text that uses Unicode punctuation, like left double quote, right single quote for apostrophe, and so on, and I need it in ASCII. Does Python have a database of these characters with ...
8 votes
3 answers
19k views
Python .split() without 'u
In Python, if I have a string like: a =" Hello - to - everybody" And I do a.split('-') then I get [u'Hello', u'to', u'everybody'] This is just an example. How can I get a simple list without that ...
8 votes
3 answers
11k views
Convert pandas dataframe to tuple of tuples
I have the following pandas dataframe df: Description Code 0 Apples 014 1 Oranges 015 2 Bananas 017 3 Grapes 021 I need to convert it to a tuple of ...
0 votes
2 answers
7k views
Convert unicode special symbol in python
I read the symbol °C using xlrd library. I get the unicode value as u'\xb0C'. However I want to use it as a normal string. I went through a couple of posts including the below link Convert a Unicode ...
4 votes
1 answer
2k views
Converting Unicode objects with non-ASCII symbols in them into strings objects (in Python)
I want to send Chinese characters to be translated by an online service, and have the resulting English string returned. I'm using simple JSON and urllib for this. And yes, I am declaring. # -*- ...