fileinput.input()
fileinput.input() is a Python function in the Fileinput Module category. Iterates over lines from multiple input files (like awk). The syntax is fileinput.input(files=None, inplace=False, backup="", *, mode="r", openhook=None, encoding=None, errors=None). Returns: FileInput iterator. A typical example: import fileinput
for line in fileinput.input(files=["a.txt", "b.txt"]):
print(line.rstrip()). A close sibling is fileinput.filename(), which returns the current file name being processed. A close sibling is fileinput.filelineno(), which returns the line number in the current file (1-based). A close sibling is fileinput.lineno(), which returns the cumulative line number across all files. A close sibling is fileinput.isfirstline(), which returns True if the line is the first line of its file. More about this category: File input helper — input, filename, filelineno, nextfile. Related Fileinput Module entries: fileinput.filename(), fileinput.filelineno(), fileinput.lineno(), fileinput.isfirstline(), fileinput.nextfile(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details.