Python Fileinput Module
File input helper — input, filename, filelineno, nextfile. This category documents 6 Python fileinput module entries, and each page gives you the full syntax, the parameter list, the return value, and a runnable example. The entries include: fileinput.input(), fileinput.filename(), fileinput.filelineno(), fileinput.lineno(), fileinput.isfirstline(), fileinput.nextfile(). fileinput.input() iterates over lines from multiple input files (like awk). fileinput.filename() returns the current file name being processed. fileinput.filelineno() returns the line number in the current file (1-based). fileinput.lineno() returns the cumulative line number across all files. fileinput.isfirstline() returns True if the line is the first line of its file. Fileinput Module belongs to the File & Data group alongside Pathlib Module, Shutil Module, Glob Module, Tempfile Module. You can also search across every category from the search page, browse the complete A–Z index, or try any example in the Python playground.