title: PyMySQL executemany INSERT List from variable
body: <p>I am trying to insert some data in a mysql table using pymysql but failing.
  The data is held in variables already so I need to pass them to the INSERT statement.</p>
  
  <p>this is what I am currently trying...</p>
  
  <pre><code>con = pymysql.connect(host='*.*.*.*', port=***, user='****', 
  passwd='***', db='****')
  with con:
      cur = con.cursor()
      sql = ("INSERT INTO groupMembers (groupID, members) VALUES (%s, %s)")
      data = (groupID, (x for x in membersList))
      cur.executemany(sql, data)
      con.commit()
      con.close()
  </code></pre>
  
  <p>the data I am trying to pass looks like the following....</p>
  
  <p>groupID = G9gh472</p>
  
  <p>membersList = [Dave,Bob,Mike,Bill,Colin]</p>
  
  <p>the length of the list is unknown and can vary
  the resulting table I want to look like this...</p>
  
  <pre><code>| groupID | members |
  +---------+---------+
  | G9gh472 | Dave    |
  | G9gh472 | Bob     |
  | G9gh472 | Mike    |
  | G9gh472 | Bill    |
  | G9gh472 | Colin   |
  </code></pre>
  
  <p>I have tried a few variations of this based on reading others answers, but nothing I have tried so far has worked.
  Thanks all</p>