本篇主要介绍如何使用pymysql操作数据库,下面直接进入正文
1.查询数据
# coding: utf-8
# author: hmk
import pymysql.cursors
# 连接数据库...root', # 数据库的登录用户
password='123456', # 密码
db='test', # 要操作额数据库...root', # 数据库的登录用户
password='123456', # 密码
db='test', # 要操作额数据库...root', # 数据库的登录用户
password='123456', # 密码
db='test', # 要操作额数据库...from maoyan_movie where ranking=%s"
data = (2)
cursor.execute(sql, data)
conn.commit() # 提交,不然删除操作不生效