Difference between open and codecs.open in Python

There are two ways to open a text file in Python:

f = open(filename)

And

import codecs
f = codecs.open(filename, encoding="utf-8")

When is codecs.open preferable to open?

84
задан dreftymac 12 April 2018 в 04:51
поделиться