4 ms·
Your script requires over 3x the entire file in memory (text, lines, "\n".join(lines)) whereas the posts rust/python are line by line, so support arbitrarily la
by mbb70 2y ago
Your script requires over 3x the entire file in memory (text, lines, "\n".join(lines)) whereas the posts rust/python are line by line, so support arbitrarily large files.
- Ukv 2y agoIf you are dealing with many-gigabyte files or a performance-critical pipeline then yeah, you'd want to do it line-by-line. My example is just a quick and dirty script, or REPL input, without any of the boilerplate - which I think is an area Python excels in.