Skip to content

Instantly share code, notes, and snippets.

@mattyw
Created September 14, 2011 20:36
Show Gist options
  • Save mattyw/1217714 to your computer and use it in GitHub Desktop.
Save mattyw/1217714 to your computer and use it in GitHub Desktop.
Python Shelving
def add(x, y):
return x + y
def subtract(x, y):
return x - y
import shelve
d = shelve.open('shelve_state.dat')
d['add'] = add
d['subtract'] = subtract
func = d['add']
print func(3,5)
func = d['subtract']
print func(5, 1)
d.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment