Track 7 · Lesson 7 of 11
Parsing structured text
Turn settings files, log lines and simple comma-separated data into Python dictionaries and lists, line by line, and see where hand-written parsing stops working.
You will be able to
- Process multi-line text line by line with splitlines(), skipping blank and comment lines
- Parse key=value settings into a dictionary, including values that contain the separator
- Break log lines into named fields with split(maxsplit=...) and checks on each part
- Convert simple comma-separated text with a header row into a list of dictionaries
- Explain why quoted fields need the csv module instead of split(",")
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.