[英]How to save back changes made to a HTML file using BeautifulSoup in Python?
[英]how to save the changes made in SQL using Python?
我編寫了一個代碼,使用 python 在 SQL 中輸入數據。 一切正常,但是當程序關閉時,輸入的所有數據都會丟失。 考慮這段代碼。
os.system('cls')
nme = input("enter your name: ")
usid = input("enter your userID: ")
pasd = getpass.getpass("please enter a pin in digits, characters are not supported: ")
entry = """insert into users (name, ID, pin) values(%s, %s, %s)"""
data = (nme, usid, pasd)
curs.execute(entry, data)
curs.commit()
我在 web 上發現curs.commit()
保存所做的更改,但顯示錯誤。 這就是編譯器顯示的錯誤!!
從連接 object 得到的 Cursor 僅用於運行查詢。 如果您需要在失敗時提交/回滾,請在連接 object 本身上執行此操作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.