3 ms·
Filters over lines of text may be domain-specific, but it sure as hell spans a lot of domains.
by naniwaduni 7y ago
Filters over lines of text may be domain-specific, but it sure as hell spans a lot of domains.
- jstimpfle 7y agoIdk, 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.