diff --git a/Lib/shelve.py b/Lib/shelve.py index e617e89b823..807a0bb0b9b 100644 --- a/Lib/shelve.py +++ b/Lib/shelve.py @@ -59,6 +59,11 @@ class Shelf: def has_key(self, key): return self.dict.has_key(key) + + def get(self, key, default=None): + if self.dict.has_key(key): + return self[key] + return default def __getitem__(self, key): f = StringIO(self.dict[key])