Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
98 views
in Technique[技术] by (71.8m points)

python - I'm trying to insert some data into a mysql table but i receive an interface error how can i fix it?

Here's the code, i want to insert data from a website into a mysql table.

import requests
import mysql.connector
from bs4 import BeautifulSoup
r_1=requests.get(...)
soup=BeautifulSoup(r_1.content,'html.parser')
r_2=soup.find(id='main')
r_3=r_2.find_all('div',class_='...')
cnx=mysql.connector.connect(user=m_1,password=m_2,database=m_3)
cursor=cnx.cursor()
for i in r_3: 
    r_4=i.find('h4',class_='...')
    r_5=i.find('div',class_='...')
    r_6=r_5.find('div',class_='...')
    a_1=(r_4.text,r_6.text)
    cursor.executemany('insert into truecar (price,Miles) values (%s,%s)',a_1)
cursor.close()
cnx.commit()

I receive the error below

Exception has occurred: InterfaceError Failed executing the operation; Could not process parameters

question from:https://stackoverflow.com/questions/65944418/im-trying-to-insert-some-data-into-a-mysql-table-but-i-receive-an-interface-err

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...