操作mysql脚本
def mysql_conn(): while 1: try: conn, mysql = mysql_conn_e() return conn, mysql except Exception as e: print("save 链接数据库 出错") time.sleep(1) def mysql_conn_e(): conn = pymysql.connect(host=DBHOST, port=DBPORT, user=DBUSER, password=DBPWD, database=DBNAME, charset=DBCHAR) mysql = conn.cursor(cursor=pymysql.cursors.DictCursor) return conn, mysql