Track 8 · Lesson 4 of 11
Processing files line by line
Stream through large files one line at a time to count, filter, transform and write results without loading the whole file.
You will be able to
- Explain why looping over a file uses little memory however large the file is
- Split each line into fields and count or total values while streaming
- Filter matching lines into a new file, reading and writing at the same time
- Use enumerate() for line numbers and skip blank, comment and malformed lines
Included with a Formula Quest membership
It has 4 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.
View Formula Quest memberships
Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.