Daily Python
Day 15Python~45 min
Read files & parse data
Load structured text from disk
Track progress0/15 days
What you'll learn
readlinessplit blocksparseFileNotFoundError
- Read multi-line files and parse sections
- Build a recipe viewer from a text file
Lesson & examples
Read the code, then the explanation — try changing values before the project.
Read line by line
with open("sample.txt", "r") as f:
for line in f:
print(line.strip())