title: Read in tuple of lists from text file as tuple, not string - Python
body: <p>I have a text file I would like to read in that contains rows of tuples. Each tuple/row in text is in the form of ('description string', [list of integers 1], [list of integers 2]).  Where the text file might look something like:</p>
  
  <p>('item 1', [1,2,3,4] , [4,3,2,1])<br>
  ('item 2', [ ] , [4,3,2,1])<br>
  ('item 3, [1,2] , [ ])</p>
  
  <p>I would like to be able to read each line in from the text file, then place them directly into a function where,</p>
  
  <pre><code>function(string, list1, list2)
  </code></pre>
  
  <p>I know that each line is read in as a string, but I need to extract this string some how.  I have been trying to use a string.split(','), but that comes into problems when I hit the lists.  Is there a way to accomplish this or will I have to modify my text files some how?</p>
  
  <p>I also have a text file of a list of tuples that I would like to read in similarly that is in the form of</p>
  
  <p>[(1,2),(3,4),(5,6),...]</p>
  
  <p>that may contain any amount of tuples. I would like to read it in a  list and do a for loop for each tuple in the list.  I figure these two will use roughly the same process.</p>