[Tutor] codecs.open vs io.open

Mark Lawrence breamoreboy at yahoo.co.uk
Tue Mar 3 17:08:19 CET 2015


On 03/03/2015 10:31, Albert-Jan Roskam wrote:
> Hi,
>
> Is there in a (use case) difference between codecs.open and io.open? What is the difference?
> A small difference that I just discovered is that codecs.open(somefile).read() returns a bytestring if no encoding is specified, but a unicode string if an encoding is specified. io.open always returns a unicode string.
>
> Thank you!
>
> Regards,
>
> Albert-Jan
>

You might get an answer here if you're lucky, but I believe this is more 
python-list territory.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence



More information about the Tutor mailing list