title: Python, how to insert a list into column of table in given order
body: <p>My table has 3 columns: ID, Author and In_order. I am reading in a file and a line contains a list of authors separated by a comma. What I am trying to achieve is inserting the names of the authors into the author column with its correct ID in the ID field and then the position in which it appears in the list (which will always be in order). What I want in the end is my table looking like this:</p>
  
  <pre><code>ID    Author    In_order
  1     Author1    1
  1     Author2    2
  1     Author3    3
  2     Author1    1
  2     Author2    2
  3     Author1    1
  3     Author2    2
  </code></pre>
  
  <p>I have used the enumerate function to give each author a position in the list. </p>
  
  <p>Here is the code relevant to this question. </p>
  
  <pre><code>author_list = line.split(",")
  
          for In_order, author in enumerate(author_list, start=1):
              In_order = In_order
              author = author
  
  db1.execute('''INSERT INTO authors(
                      ID, AUTHOR, In_order) VALUES(%s,%s,%s)''',
                      (ID, author, In_order))
  </code></pre>
  
  <p>I wasn't sure what exactly to store in both the In_order and author variables. 
  The code runs but only the last author on the list is inserted into the table along with its corresponding ID and its correct position on the list. Ie.:</p>
  
  <pre><code>ID    Author    In_order
  1     Author3    3
  2     Author2    2
  3     Author2    2
  </code></pre>
  
  <p>Any advice would be appreciated I am new to both python and mysql!</p>