Python realizes the operation of MySQL [addition, deletion, modification and query]

No gossip, just go straight to the operation!

1. Preparation

1. Install MySQL and Python locally (take 3.6 as an example)
2. MySQL creates a new database [test], a new table [user], and a new field [name] [age]
3. Create a table method: navicat tool
insert image description here
field
insert image description here

Two, Python operation - insert data

#!/usr/bin/env 
# coding=utf-8

import pymysql
# Python 连接MySQL-本地测试
def main():
    # 1.设置连接
    db 

Guess you like

Origin blog.csdn.net/ZZQHELLO2018/article/details/131670320