首页 > 其他分享 >fileinput.input函数 是对 fileinput.FileInput 类的再封装

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

时间:2023-06-20 11:13:28浏览次数:38  
标签:封装 函数 fileinput state FileInput input

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 函数的再封窗

 

标签:封装,函数,fileinput,state,FileInput,input
From: https://www.cnblogs.com/sangern/p/17493065.html

相关文章