Challenge
Parser function
Move the feed parser from "Line to record" into parse_line(line), which returns the record dict, then let it return None for blank, comment and damaged lines so the loop only keeps real records.
Showing 11–16 of 16
Challenge
Move the feed parser from "Line to record" into parse_line(line), which returns the record dict, then let it return None for blank, comment and damaged lines so the loop only keeps real records.
Challenge
Write assert checks for parse_line() from "Parser function": the whole record for a good line first, then None for a blank line, a comment and a line with a missing field, so a broken parser can't…
Challenge
Extend the feed parser so continue skips blank lines and comment lines, then report damaged lines with too few fields instead of crashing, with a count of parsed and damaged lines.
Challenge
A 70-line engine report repeats the same twelve lines for each engine. Restructure it into parse_feed() and summary_line() with the output unchanged to the character, then add assert tests that would…
Challenge
…line", and start each line with the clock time from the timestamp: 09:30:05 ENG-2: 412.5 C 09:30:05 TANK-1: 78.3 % 09:30:10 CABIN: 101.2 kPa 09:30:10 ENG-2: 415.0 C timestamp, sensor, value, unit =…
Challenge
…at the commas as before. The time of day is [11:19] of the timestamp. print() puts a space between its values. Aligned columns Now make it a report: a header row and columns that line up, with the…