Py3: Read file with Unicode characters
Gnarlodious
gnarlodious at gmail.com
Thu Apr 8 11:52:06 EDT 2010
On Apr 8, 9:14 am, "Martin v. Loewis" wrote:
> When opening the file, you need to specify the file encoding.
OK, I had tried this:
open(path, 'r').read().encode('utf-8')
however I get error
TypeError: Can't convert 'bytes' object to str implicitly
I had assumed a Unicode string was a Unicode string, so why is it a
bytes string?
Sorry, doing Unicode in Py3 has really been a challenge.
-- Gnarlie
More information about the Python-list
mailing list