fileinput.input函數(shù) 是對(duì) fileinput.FileInput 類(lèi)的再封裝
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函數(shù) 是對(duì) fileinput.FileInput 類(lèi)的再封裝
fileinput.FileInput 類(lèi)是對(duì) open 函數(shù)的再封窗

浙公網(wǎng)安備 33010602011771號(hào)