# 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()
# count = cursor.execute('select * from goods;')
# print('查詢到%d條數(shù)據(jù)'%count)
# print(cursor.fetchone())
# print(cursor.fetchone())
# print(cursor.fetchone())
# print(cursor.fetchone())
# print(cursor.fetchmany())#獲取一條
# print(cursor.fetchmany(3))#傳人幾條獲取幾條
# print(cursor.fetchall())
# #關(guān)閉Cursor對象
# cursor.close()
# conn.close()
# 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()
#報錯原因是
#雙引號嵌套,可以使用三個引號员串。來代表完整字符串