diff --git a/demo.py b/demo.py new file mode 100644 index 0000000..c462a78 --- /dev/null +++ b/demo.py @@ -0,0 +1,21 @@ +import pymysql +import pymysql.cursors +from dotenv import dotenv_values +from pprint import pprint + +config = dotenv_values(".env") +conn = pymysql.connect(host=config['MYSQL_HOST'], user=config['MYSQL_USER'], password=config['MYSQL_PASSWORD'], database=config['MYSQL_NAME'], cursorclass=pymysql.cursors.DictCursor) +cursor = conn.cursor() +cursor.execute("SELECT * FROM web_images WHERE id=1436682 LIMIT 5") + +# 获取查询结果 +rows = cursor.fetchall() +for row in rows: + # 格式化打印 + pprint(row) + + + +# 关闭游标和连接 +cursor.close() +conn.close() diff --git a/main.py b/main.py index db4ed23..890cd4e 100644 --- a/main.py +++ b/main.py @@ -55,14 +55,3 @@ for row in rows: # 关闭游标和连接 cursor.close() conn.close() - - -''' -from cnocr import CnOcr - -img_fp = './x.jpg' -ocr = CnOcr(rec_model_name='ch_PP-OCRv3') # 所有参数都使用默认值 -out = ocr.ocr(img_fp) - -print(out) -'''