I have an excel file I am reading in python using the xlrd module. I am extracting the values from each row, adding some additional data and writing it all out to a new text file. However I am running into an issue with cells that contain text with the fraction 3/4. Python reads the value as \xbe, and each time I encounter it, I get this error:
UnicodeEncodeError: 'ascii' codec can't encode character u'\xbe' in position 317: ordinal not in range(128)
I am converting my list of values from each row into a string, have tried the following without success:
row_vals_str = [unicode(str(val), 'utf-8') for val in row_vals]
row_vals_str = [str(val).encode('utf-8') for val in row_vals]
row_vals_str = [str(val).decode() for val in row_vals]
Each time I hit the first occurrence of the 3/4 fraction I get the same error.
How can I convert this to something that can be written to text?
I came across this thread but didn't find an answer: How to convert \xXY encoded characters to UTF-8 in Python?