主從服務(wù)器
# from pymysql import connect
# # #創(chuàng)建Connection連接
# conn = connect(host = 'localhost',port = 3306,user = 'root' ,password = 'hezhuang',database = 'TCL',charset = 'utf8')
# # #? 獲得Cursor對象
# cursor = conn.cursor()
# # print(cursor.execute(''' into goods_cates(name) value("硬盤1")'''))
# # print(cursor.execute(''' into goods_cates(name) value("硬盤2")'''))
# # print(cursor.execute(''' into goods_cates(name) value("硬盤3")'''))
# conn.commit()
# #報錯原因是
# #雙引號嵌套,可以使用三個引號拉背。來代表完整字符串
# print(cursor.execute(''' into goods_cates(name) value("硬盤3")'''))
# print(cursor.execute(''' into goods_cates(name) value("硬盤4")'''))
# #假如執(zhí)行代碼有錯時可以先執(zhí)行
# conn.rollback()
# #重新回滾
# print(cursor.execute(''' into goods_cates(name) value("硬盤4")'''))
# conn.commit()
#報錯原因是
#雙引號嵌套,可以使用三個引號项玛。來代表完整字符串