title: How to save and load a list in a txt file
body: <p>I have a list of names
  <code>list = ["Bob", "Fred", "George", "Garry"]</code> and I would like to be able to save it after changing it (like if I were to add another name to the list) and then load it again later. So far I save it by: </p>
  
  <pre><code>    text_file = open("/Users/xxxxxx/Desktop/names.txt", "w")
      text_file.write(str(list))
      text_file.close()
      print("Your list has been saved!")
  </code></pre>
  
  <p>This saves the list as a string <code>['Bob', 'Fred', 'George', 'Garry']</code> so when I load it again I can't access it as a list. </p>
  
  <pre><code>testList=[]
  with open("/Users/xxxxxxx/Desktop/names.txt") as f:
          for line in f:
              testList.append(line)
          print(testList[0])
  </code></pre>
  
  <p>Output: <code>['Bob', 'Fred', 'George', 'Garry']</code></p>
  
  <p>I want it so I can <code>print(testList[0])</code> and get <code>Bob</code> after loading the list I saved earlier.</p>