2 ms·
Python comes with a built-in module called fileinput that makes this very easy. It checks sys.argv[1] and reads from it or from stdin if it's empty or a dash.
by hiccuphippo 3y ago
Python comes with a built-in module called fileinput that makes this very easy. It checks sys.argv[1] and reads from it or from stdin if it's empty or a dash.
https://docs.python.org/3/library/fileinput.html https://docs.python.org/3/library/fileinput.html