title: what is the error in insert statement into mysql in python in the following example?
body: <p>Iam trying to crawling web site then retrieve data from this web site and insert into table into mysql using python 3, the data that i want to insert in table is tuble and i implemented <code>get_article_details</code> function , it result data correctly. But i have a problem in insert statement as the following:</p>
  <pre><code>import pymysql
  conn=pymysql.connect(host='localhost',port=3306,user='root',password='')
  cur=conn.cursor()
  def save_data(data):
      
      cur.execute(&quot;insert into shereen.articles values&quot; +str(data))
      conn.commit()
      print(data[0]+&quot;   --&gt;&gt;saved&quot;)
  
  def get_article_details(url):
      r=requests.get(url)
      soup=BeautifulSoup(r.text)
      title=soup.title.text
      image=soup.find('div',attrs={&quot;class&quot;:&quot;articleimg&quot;}).find('img')['src']
      writer=soup.find('div',attrs={&quot;class&quot;:'pinfo'}).find('a').text
      article_date=soup.find('div',attrs={&quot;class&quot;:'pinfo'}).find('span').text.replace(&quot;|&quot;,&quot; &quot;).strip()
      body=soup.find('div',attrs={'id':'NewsStory'})
      body.find('div',attrs={&quot;class&quot;:'smsBoxContainer-v1'}).decompose()
      body.find('div',attrs={&quot;class&quot;:'min_related'}).decompose()
      body.find('div',attrs={&quot;class&quot;:'CoronaContainer inner noPaddding'}).decompose()
      article=[]
      for section in body.findAll('p'):
          article.append(section.text)
      article=''.join(article)
      keywords=soup.find('meta',attrs={'name':'keywords'})['content']
      data=(url,title,image,writer,article_date,article,keywords)
      save_data(data)
      return data
  </code></pre>
  <p>and the following error appears:</p>
  <pre><code>TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-125-026157a57db9&gt; in &lt;module&gt;
  ----&gt; 1 get_article_details(&quot;https://www.almasryalyoum.com/news/details/1994354&quot;)
  
  &lt;ipython-input-124-42023343dc13&gt; in get_article_details(url)
       16     keywords=soup.find('meta',attrs={'name':'keywords'})['content']
       17     data=(url,title,image,writer,article_date,article,keywords)
  ---&gt; 18     save_data(data)
       19     return data
       20 
  
  &lt;ipython-input-123-5db81833f7e7&gt; in save_data(data)
        4 def save_data(data):
        5 
  ----&gt; 6     cur.execute(&quot;insert into shereen.articles values&quot; ,str(data))
        7     conn.commit()
        8     print(data[0]+&quot;   --&gt;&gt;saved&quot;)
  
  ~\anaconda3\lib\site-packages\pymysql\cursors.py in execute(self, query, args)
      166             pass
      167 
  --&gt; 168         query = self.mogrify(query, args)
      169 
      170         result = self._query(query)
  
  ~\anaconda3\lib\site-packages\pymysql\cursors.py in mogrify(self, query, args)
      145 
      146         if args is not None:
  --&gt; 147             query = query % self._escape_args(args, conn)
      148 
      149         return query
  
  TypeError: not all arguments converted during string formatting
  </code></pre>