xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

資源簡介

首先在mysql中創建chat數據庫,

然后確保本地環境安裝了 pymysql 【管理員模式>>命令行工具>>pip3 install PyMySQL】

最后確保連接串與你本地一致,運行即可看到如下圖:

資源截圖

代碼片段和文件信息

import?pymysql

#??創建連接
conn?=?pymysql.connect(
????host?=?‘localhost‘
????port?=?3306
????user?=?‘root‘
????passwd=?‘root‘
????db???=?‘chat‘
????charset?=?‘utf8‘

#??實例化游標
cur?=?conn.cursor()

sql_dict?=?{
????‘show‘:‘show?databases‘
????‘creat‘:‘create?table?stu?(id?INT?PRIMARY?KEY?name?CHAR?(10)addr?CHAR?(15));‘
????‘insert‘:“insert?into?stu(idnameaddr)?VALUE?(1‘XXX‘‘XXXXX‘)(2‘XXX‘‘XXXXX‘);“
????‘select‘:‘select?*?from?stu;‘
????‘update‘:“update?stu?set?addr=‘??‘?where?id=2;“
????‘delete‘:“delete?from?stu?where?id=1;“
????‘drop‘:‘drop?table?stu;‘
}

#??執行SQL語句
cur.execute(sql_dict[‘show‘])
#??獲取所有數據
datas?=?cur.fetchall()
for?db_info?in?datas:
?????print(db_info)
#??創建表格
tr

評論

共有 條評論