Topic

Python

Python runs on your PC, next to the board. Eight short insights take you from the REPL to a script that turns a serial log into a spreadsheet. Each one is a 3-minute read with a diagram, code that runs, and the output it prints.

Read the first insight
scan.pyPython
log = """00:01 INFO boot ok00:05 ERROR i2c timeout00:09 ERROR i2c timeout"""errors = [l for l in log.splitlines()          if "ERROR" in l]print(len(errors), "errors")
Output
2 errors

Insights