用python怎样把xml的数据导入到mysql数据库里
1个回答
推荐于2017-08-26
展开全部
用python怎样把xml的数据导入到mysql数据库里
with open("fileinfo.txt", "rt") as handle:
datas = [ln.split('\t') for ln in handle]
conn = MySQLdb.connect(host='localhost', user='mysql', passwd='', db='db')
curr = conn.cursor()
curr.executemany("insert into tb values (?, ?, ?)", datas)
conn.commit()
with open("fileinfo.txt", "rt") as handle:
datas = [ln.split('\t') for ln in handle]
conn = MySQLdb.connect(host='localhost', user='mysql', passwd='', db='db')
curr = conn.cursor()
curr.executemany("insert into tb values (?, ?, ?)", datas)
conn.commit()
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询