finding a component in a list of pairs
Peter Pearson
pkpearson at nowhere.invalid
Mon Jun 24 12:36:15 EDT 2019
More information about the Python-list mailing list
Mon Jun 24 12:36:15 EDT 2019
- Previous message (by thread): finding a component in a list of pairs
- Next message (by thread): generator to write N lines to file
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[snip] > print( dict( pairs ).get( 'sun', '(unknown)' )) You probably know this, but . . . just in case . . . If you're doing this many times, you'll want to construct the dict just once and then make many references to the dict, rather than re-constructing the dict every time you want to look up an element. -- To email me, substitute nowhere->runbox, invalid->com.
- Previous message (by thread): finding a component in a list of pairs
- Next message (by thread): generator to write N lines to file
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list