Skip to content

Instantly share code, notes, and snippets.

@timtan
Last active December 16, 2015 19:50
Show Gist options
  • Select an option

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

Select an option

Save timtan/5488222 to your computer and use it in GitHub Desktop.
please fill in addData and show Data
import shelve
def addData(data):
#figure how to add data
pass
def showData(data):
# display your organized data
pass
init_data = shelve.open('sample.db')
## Check the init_ata is well organized, or you need to organized by yourself
print "commands ? press A to add a name, press L to list all names"
print ">",
command = raw_input()
if command == 'A':
print "data to add is: "
addData(init_data)
elif command == 'L':
showData(init_data)
print "-- end of data --"
else:
print 'you should press A or L'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment