[Tutor] codecs.open vs io.open

Albert-Jan Roskam fomcl at yahoo.com
Tue Mar 3 11:31:01 CET 2015


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



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a 

fresh water system, and public health, what have the Romans ever done for us?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


More information about the Tutor mailing list