PyDocs

Nav

Command-line interface libraries

FileInput

  • FileInput(files=None, inplace=False, backup='', *, mode='r', openhook=None, encoding=None, errors=None)
FileInput([files[, inplace[, backup]]], *, mode=None, openhook=None)

Class FileInput is the implementation of the module; its methods
filename(), lineno(), fileline(), isfirstline(), isstdin(), fileno(),
nextfile() and close() correspond to the functions of the same name
in the module.
In addition it has a readline() method which returns the next
input line, and a __getitem__() method which implements the
sequence behavior. The sequence must be accessed in strictly
sequential order; random access and readline() cannot be mixed.
Changed in 3.2, 3.8, 3.10, 3.11
  • 3.2: Can be used as a context manager.
  • 3.8: The keyword parameter mode and openhook are now keyword-only.
  • 3.10: The keyword-only parameter encoding and errors are added.
  • 3.11: The 'rU' and 'U' modes and the __getitem__() method have been removed.
0 Examples
No examples for fileinput/FileInput.
See Also
No see-alsos for fileinput/FileInput
0 Notes
No notes for FileInput