3 ms·
Idk, it never occurred to me the need for a library that does more than "for line in sys.stdin:" but less than what you can easily write in under a minute.
by jstimpfle 7y ago
Idk, it never occurred to me the need for a library that does more than "for line in sys.stdin:" but less than what you can easily write in under a minute.
- rabidrat 7y agoIt handles files being passed on the command line too. Your particular usage might only take a minute, but to make it play nice with other expected CLI usages, takes more thought (and you will probably forget something).
- masklinn 7y ago> Idk, it never occurred to me the need for a library that does more than "for line in sys.stdin:" Of course if you'd only used fileinput for that it would be worthless. However what it does is way more useful, namely iterate on the lines of all files provided as parameter (or sys.argv[:1]), fallback to sys.stdin if no files were provided, and swap the special sentinel `-` by sys.stdin.