From 40db3c570c4f3db2481a29fdb84d3a95a14d08e0 Mon Sep 17 00:00:00 2001 From: thomas-yanxin <58030051+thomas-yanxin@users.noreply.github.com> Date: Mon, 31 Oct 2022 00:58:49 +0800 Subject: [PATCH] Delete stock_up.py --- Smart_container/stock_up.py | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 Smart_container/stock_up.py diff --git a/Smart_container/stock_up.py b/Smart_container/stock_up.py deleted file mode 100644 index d59b180..0000000 --- a/Smart_container/stock_up.py +++ /dev/null @@ -1,21 +0,0 @@ -import pymysql -import random - -db = pymysql.connect(host="localhost", user="root", passwd="105316", db="container") -print('数据库连接成功!') -cur = db.cursor() -sql = "select * from t_container" -cur.execute(sql) -result=cur.fetchall() -for row in result: - sqlQuery = "UPDATE t_container SET stock = %s WHERE number = %s" - value = (random.randint(1000, 5000), row[0]) - cur.execute(sqlQuery, value) - - -db.commit() -cur.close() -db.close() - -print("============") -print("Done! ") \ No newline at end of file