title: How do I save a list to file using python?
body: <p>I was wondering how I can save a list entered by the user. I was wondering how to save that to a file. When I run the program it says that I have to use a string to write to it. So, is there a way to assign a list to a file, or even better every time the program is run it automatically updates the list on the file? That would be great the file would ideally be a .txt.</p>
  
  <pre><code>stuffToDo = "Stuff To Do.txt"
  WRITE = "a"
  dayToDaylist = []
  show = input("would you like to view the list yes or no")
  if show == "yes":
      print(dayToDaylist)
  
  add = input("would you like to add anything to the list yes or no")
  if add == "yes":
      amount=int(input("how much stuff would you like to add"))
      for number in range (amount):
          stuff=input("what item would you like to add 1 at a time")
          dayToDaylist.append(stuff)
  remove = input("would you like to remove anything to the list yes or no")
      if add == "yes":        
      amountRemoved=int(input("how much stuff would you like to remove"))
      for numberremoved in range (amountRemoved):
          stuffremoved=input("what item would you like to add 1 at a time")
          dayToDaylist.remove(stuffremoved);
  print(dayToDaylist)
  
  file = open(stuffToDo,mode = WRITE)
  file.write(dayToDaylist)
  file.close()
  </code></pre>