osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

finding a component in a list of pairs


[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.