Difference between io.open vs open in python

后端 未结 1 924
温柔的废话
温柔的废话 2021-02-11 19:07

In the past, there\'s codecs which got replaced by io. Although it seems like it\'s more advisable to use io.open, most introductory pytho

1条回答
  •  礼貌的吻别
    2021-02-11 19:36

    Situation in Python3 according to the docs:

    io.open(file, *[options]*)

    This is an alias for the builtin open() function.

    and

    While the builtin open() and the associated io module are the recommended approach for working with encoded text files, this module [i.e. codecs] provides additional utility functions and classes that allow the use of a wider range of codecs when working with binary files

    (bold and italics are my edits)

    0 讨论(0)
提交回复
热议问题