title: Writing list of tuples to a textfile and reading back into a list
body: <p>How do I write a list of tuples to a text file and read them back into the original list format?</p>
  
  <p>My code gives:</p>
  
  <pre><code>["(50, 'AAA')\n", "(40, 'BBB')\n", "(30, 'CCC')\n", "(20, 'DDD')\n", "(10, 'EEE')\n"]
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>file = open("x.txt", "w")
  default_scores = [(10, "EEE"), (20, "DDD"), (30, "CCC"), (40, "BBB"), \
                    (50, "AAA")]
  default_scores.sort(reverse=True)
  default_score_strings = []
  for entry in default_scores:
      default_score_strings.append(str(entry) + "\n")
  file.writelines(default_score_strings)
  file.close()
  
  file = open("x.txt", "r")
  lines = file.readlines()
  file.close()
  
  print(lines)
  </code></pre>