On Fri, 23 Jun 2017 07:19 pm, Lawrence D’Oliveiro wrote: > The construct > > del «dict»[«key»] > > deletes the entry with key «key» from the dictionary «dict», provided it > exists. If it does not, you get a KeyError. > > To delete an entry which might or might not exist, the simplest way is this: > > «dict».pop(«key», None) > > Actually, the second argument to the pop method doesn’t matter, since the > result from the call is ignored in this case.
Nice hint. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list