fileinput.input函数 是对 fileinput.FileInput 类的再封装

def input(files=None, inplace=False, backup="", bufsize=0,
          mode="r", openhook=None):
    """Return an instance of the FileInput class, which can be iterated.

    The parameters are passed to the constructor of the FileInput class.
    The returned instance, in addition to being an iterator,
    keeps global state for the functions of this module,.
    """
    global _state
    if _state and _state._file:
        raise RuntimeError("input() already active")
    _state = FileInput(files, inplace, backup, bufsize, mode, openhook)
    return _state

  fileinput.input函数 是对 fileinput.FileInput 类的再封装

 

fileinput.FileInput 类是对 open 函数的再封窗

 

posted @ 2023-06-20 11:01  sangern  阅读(12)  评论(0编辑  收藏  举报