Python: Unicode and "\xe2\x80\x99" driving me batty
If you're stuck with Python 2 and want to use Rahul's answer
import io
with io.open("oblivion.txt", "r", encoding='utf-8') as bookFile:
wordList = bookFile.readlines()
Try open
with encoding
as utf-8
:
with open("oblivion.txt", "r", encoding='utf-8') as bookFile:
wordList = bookFile.readlines()