I understand there are many non ascii characters questions on stackoverflow but since I'm a total newb I've had no luck in successfully implementing them, plus I find the whole 'unicode' concept difficult to understand.
So I have a list -
mylist = ["apple", "samsung", "toshiba", "Don’t know", "Can’t recall"]
I would like to access the single quote marks at index 3 and 4 and replace them with an apostrophe.
I tried this:
# -*- coding: utf-8 -*-
mylist = ["hello", "don't know", "Don’t know", "Can't recall"]
for word in mylist:
word.replace(u"’", "'")
print mylist
I get the following error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 3: ordinal not in range(128)
Not sure if this is useful but I am using python version 2.x and I know that this problem may not occur if I was using version 3.
Thanks!