Difference between io.open vs open in python

后端 未结 1 1883
野趣味
野趣味 2021-02-11 19:02

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:31

    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)
提交回复
热议问题