7 Gashlycrumb: Looking items up in a dictionary

In this chapter, we’re going to look up lines of text from an input file that start with the letters provided by the user. The text will come from an input file that will default to Edward Gorey’s “The Gashlycrumb Tinies,” an abecedarian book that describes various and ghastly ways in which children expire. For instance, figure 7.1 shows that “N is for Neville who died of ennui.”

Table 7.1 N is for Neville who died of ennui.

Our gashlycrumb.py program will take one or more letters as positional arguments and will look up the lines of text that start with that letter from an optional input file. ...

Get Tiny Python Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.