title: Adding multiple values to MySQL inside a loop
body: <p>I scrape a list of elements from the site and extract two values from it. The <code>text</code> and the <code>href</code>. I cannot figure out how to add these to the <code>mysql</code> DB in side a loop. I tried <code>execute</code> inside the loop, without using the list they are appeneded to, that failed. So, I tried <code>executemany</code> but I think my format might be incorrect. I saw examples where a list of tuples is fed to <code>executemany</code>, I don't know how to do that in this case.</p>
  <pre><code>                for name in name_eles:
                      names_list.append(name.text)
                      n_li = name.get_attribute('href')
                      names_links.append(n_li)
                  sql = &quot;INSERT INTO profiles(company, coprofile) VALUES (%s,%s)&quot;
                  val = [(name for name in name_list),(n_li for n_li in names_links)]
                  cursor.executemany(sql,val)
  </code></pre>
  <p>This is the error I get.</p>
  <pre><code>MySQLdb._exceptions.ProgrammingError: not all arguments converted during bytes formatting
  </code></pre>