# -*- coding: utf-8 -*- """ @author:zhaiht @file: mysqlUtil.py @time: 2020/8/6 14:54 @desc: """ import pymysql class mysqlConn: def __init__(self, host, user, pwd, db): self.host = host self.user = user self.pwd = pwd self.db = db self.__connect() def __connect(self): self.__connection = pymysql.connect(self.host, self.user, self.pwd, self.db) self.__cursor = self.__connection.cursor() def close(self): self.__cursor.close() self.__connection.close()