title: Python- Saving Results to a File and Recalling Them
body: <p>I'm writing a program in Python that will store Student IDs, names, and D.O.B.s. </p>
  
  <p>The program gives the user the ability to remove, add, or find a student. Here is the code: </p>
  
  <pre><code>students={}
  
  def add_student():
    #Lastname, Firstname
    name=raw_input("Enter Student's Name")
    #ID Number
    idnum=raw_input("Enter Student's ID Number")
    #D.O.B.
    bday=raw_input("Enter Student's Date of Birth")
  
    students[idnum]={'name':name, 'bday':bday}
  
  def delete_student():
    idnum=raw_input("delete which student:")
    del students[idnum]
  def find_student():
    print "Find" 
  menu = {}
  menu['1']="Add Student." 
  menu['2']="Delete Student."
  menu['3']="Find Student"
  menu['4']="Exit"
  while True: 
    options=menu.keys()
    options.sort()
    for entry in options: 
      print entry, menu[entry]
  
    selection=raw_input("Please Select:") 
    if selection =='1': 
      add_student()
    elif selection == '2': 
      delete_student()
    elif selection == '3':
      find_students 
    elif selection == '4': 
      break
    else: 
      print "Unknown Option Selected!" 
  </code></pre>
  
  <p>The problem I am having is I cannot figure out how to have the program save any added records to a file when the program ends. It also would need to read back the records when the program restarts. </p>
  
  <p>I keep trying to find tutorials for this sort of thing online, but to no avail. Is this the sort of code I'd want to add?: </p>
  
  <pre><code>f = open("myfile.txt", "a")
  </code></pre>
  
  <p>I'm new to Python so any help would be appreciated. Thanks so much. </p>