python爬虫 - Python 爬虫抓取网页数据,不能插入数据库中,求指点???
大家讲道理
大家讲道理 2017-04-17 15:47:39
0
4
378
大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

répondre à tous(4)
PHPzhong

代码没有仔细看,但是很明显的问题是insert语句的execute之后没有commit transcation

解决方法:

cur.execute('insert into ipList(ipList) values(%s)', ip_list[j])的下一行添加

conn.commit()
Ty80

要是没出异常,那指定是数据库用的InnoDB引擎吧?
你得提交事务,execute完所有语句之后,加上conn.commit()试试

小葫芦

插入之后,你可以 在用命令行去查询查询或者插入 看数据库是否会被锁定。。就知道是不是 事务未结束了

阿神

或者开启自动提交conn.autocommit(True)

Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!