4 ms·
I use Python's `fileinput.FileInput()` a lot for ad hoc scripts, because its behavior is to read from STDIN if available, or to attempt to open a file from `sys
by john-radio 3y ago
I use Python's `fileinput.FileInput()` a lot for ad hoc scripts, because its behavior is to read from STDIN if available, or to attempt to open a file from `sys.argv[1]` (possibly `[1:]`?) if not, which covers a ton of this kind of use cases.