title: writing a python dictionary to a text file python
body: <p>im storing a text file to a python dictionary, making changes to the text file.</p>
  
  <p>The issue im facing is with updating the dictionary contents to the text file.</p>
  
  <p>Code to read text file:</p>
  
  <pre><code>    with open ('wvtc_data.txt','r')as x:
        for line in x:
              line = line.rstrip ('\n')
              items = line.split (':')
              key,value = items[0], items[1:]
              main_dic[key] = value
              choice=0
              while choice != QUIT:
                    choice = get_menu_choice()
                    if choice==DISPLAY:
                        display(main_dic)
                    elif choice==CHANGE:
                        change(main_dic)
                    elif choice== REMOVE:
                        remove (main_dic)
                    elif choice==WRITE:
                        write(main_dic)
  </code></pre>
  
  <p>I need the write function (the last one)to update the text file with the changes made to the dictionary 
  Please help!</p>