解决数据库录入时间问题

This commit is contained in:
lsy2246 2024-04-07 13:54:31 +08:00
parent 75313d57a5
commit 90e5cb15e5

View File

@ -53,9 +53,8 @@ def detection_work_day():
English = test[0] English = test[0]
Chinese = test[1] Chinese = test[1]
works.append(English) works.append(English)
Data = time.strftime("%Y-%m-%d", time.localtime()) cursor.execute('insert into Mistake(English, Chinese)\n'
cursor.execute('insert into Mistake(English, Chinese, Date)\n' f"values ('{English}','{Chinese}')")
f"values ('{English}','{Chinese}','{Data}')")
cursor.execute(f"update Work set frequency = frequency+1 where English='{English}'") cursor.execute(f"update Work set frequency = frequency+1 where English='{English}'")
conn.commit() conn.commit()
i += 1 i += 1