fileinput
fileinput — Iterate over lines from multiple input streams
Source code: Lib/fileinput.py
This module implements a helper class and functions to quickly write a loop over standard input or a list of files. If you just want to read or write one file see open()
.
The typical use is:
import fileinput for line in fileinput.input(): process(line)
This iterates over the lines of all files listed in sys.argv[1:]
, defaulting to sys.stdin
if the list is empty. If a filename is '-'
, it is also replaced by sys.stdin
. To specify