python使用pymysql操作MySQL的基础操作

上传:lyqiqi81463 浏览: 34 推荐: 0 文件:PDF 大小:30.19KB 上传时间:2020-12-23 03:44:14 版权申诉
最近在学习python爬虫,写一下关于MySQL数据库操作的笔记 有错误的话还请看到的大佬们指正 1.导包 import pymysql 2.链接数据库 conn = pymysql.connect(host='127.0.01',port=3306,\nuser='root',password='123456') 3.获取游标 cursor=conn.cursor() 4.创建数据库和表 4.1 创建database cursor.execute('CREATE database if not exists duanzi') 4.2 创建table cursor.execute('C
上传资源
用户评论