这两天搞python爬虫,想着把爬下来的数据放到mysql中-然后查到了pymysql
第一步肯定去找官方文档咯-戳我去github
然后install--sample-想着这难不倒我啊
copy sample进去连接本地mysql--结果蛋疼了,module 'pymysql' has no attribute 'connect'
难道没安装成功?点击也能看源码啊-我草,官方文档还能坑人?Google中-发现了这个
Error
conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='', db='pymysql')
AttributeError: 'module' object has no attribute 'connect'
这是下面的回答:
You've called some other module "pymysql". Look for a file named "pymysql.py" and rename it, and remove any associated .pyc file.
慢着--我擦,名字起错了!错了!了!!!---不要起import的包名作为文件名啊!
好吧,我承认我是来搞笑的!