Back to Lesson
Data Accumulation
Streamline continuous collection parsing patterns using the walrus operator.
Instructions
- You have raw data lines..
lines = ["info: active", "info: cached", "", "error: dead"] - To verify against an iterative stream cleanly ending at whitespace, while loops are frequently employed.
- Instead of configuring messy pre-loads, utilize.
while (entry := lines.pop(0)) != "": - Process each loop tick printing the logged entries.
main.py
main.py
Ctrl + Enter