On Mar 26, 2:35 pm, Mudcat <mnati...@gmail.com> wrote:
> I would like to use a dictionary to store byte table information to
> decode some binary data. The actual number of entries won't be that
> large, at most 10. That leaves the other 65525 entries as 'reserved'
> or 'other' but still need to be somehow accounted for when
> referenced.


I seems like all you really need it to use the get method.  If the
item doesn't exist in the dictionary it returns None (or whatever you
pass in as the optional second argument).  For instance:


d = { 1: "s", 56: "w", 4363: "n", 8953: "k" }

d.get(1) -> "s"
d.get(56) -> "w"
d.get(10) -> None
d.get(10,"x") -> "x"


Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to