Skip to content

Instantly share code, notes, and snippets.

@timtan
Created April 23, 2013 12:43
Show Gist options
  • Select an option

  • Save timtan/5443255 to your computer and use it in GitHub Desktop.

Select an option

Save timtan/5443255 to your computer and use it in GitHub Desktop.
import shelve
s = shelve.open('test_shelf')
try:
print s['key1']
value_for_key1 = s['key1']
value_for_key1['new_value'] = 'this was not here before'
s['key1'] = value_for_key1
finally:
s.close()
s = shelve.open('test_shelf.db', writeback=True)
try:
print s['key1']
finally:
s.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment