tanyhuan 2020-02-01
目录
import pymysql # 连接mysql的三方库,可以pip3 install pymysql安装 def exc1(host, port, db, charset, sql): conn = pymysql.connect(host, port, db, charset) conn.execute(sql) return xxx def exc2(proc_name): conn = pymysql.connect(host, port, db, charsett) conn.call_proc(sql) return xxx exc1('1.1.1.1', 3306, 'db1', 'utf-8', 'select * from t1') exc1('1.1.1.1', 3306, 'db1', 'utf-8', 'select * from t2') exc1('1.1.1.1', 3306, 'db1', 'utf-8', 'select * from t3') exc1('1.1.1.1', 3306, 'db1', 'utf-8', 'select * from t4')
def exc1(sql, host='1.1.1.1', port=3306, db='db1', charset='utf-8'): conn = pymysql.connect(host, port, db, charset) conn.execute(sql) return xxx exc1('select * from t1') exc1('select * from t2') exc1('select * from t3') exc1('select * from t4')
import pymysql class Foo: def __init__(self, host, port, db, chartset): self.host = host self.port = port self.db = db self.charset = chartset def exc1(self, sql): conn = pymysql.connect(self.host, self.port, self.db, self.charset) conn.execute(sql) return xxx def exc2(self, proc_name): conn = pymysql.connect(self.host, self.port, self.db, self.charsett) conn.call_proc(sql) return xxx obj1 = Foo('1.1.1.1', 3306, 'db1', 'utf-8') obj1.exc1('select * from t1') obj1.exc1('select * from t2') obj1.exc1('select * from t3') obj1.exc1('select * from t4') obj2 = Foo('1.1.1.2', 3306, 'db1', 'utf-8') obj2.exc1('select * from t4')
iviewer是一个具有缩放和图像旋转功能的图像查看小部件。在jQuery官网下载后,有很多文件。直接把文件夹解压拖到项目里。然后再html中引入主要的文件。-- iviewer-鼠标滚轮js -->