January 11, 2019
Python:Mysql连库及简单封装使用, python mysql操作类
实例 1:
通过 db_config.json 加载数据库配置; 常规的增删改查进行封装
代码
连库配置: db_config.json
{
"host": "192.168.7.251",
"user": "root",
"password": "123456",
"db": "mars",
"charset": "utf8",
"port": 3306
}
封装工具类: mysqlutils.py
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# author: xu3352<xu3352@gmail.com>
# python3 环境
"""
Python Mysql 工具… Read More