title: How to insert a list containing values seperated by comma into MySQL database using python
body: <p>I have to insert a list having integer values into a column of MySQL database table using Python. First I tried </p>
  
  <pre><code>cur.execute("insert into time_Interval (name, time_interval_list) values (%s, %s)",\
          #   (user_name, interval_list))
  </code></pre>
  
  <p>Where "interval_list" is the list variable having values that I want to insert into "time_interval_list" column of "time_Interval" table. Code is working but does not insert the values. Then I tried  <a href="https://stackoverflow.com/questions/8316176/insert-list-into-my-database-using-python">this solution</a> changing the code as</p>
  
  <pre><code>var_string = ','.join('?' * len(interval_list))
  cur.execute("insert into time_Interval (name, time_interval_list) values (%s, %s)",\
              (user_name, var_string))
  </code></pre>
  
  <p>Again, code was working fine but inserts a list of question mark. I am unable to find the solution.</p>
  
  <p>How to do this correctly. Any suggestion will be appreciated</p>