python使⽤pymysql对数据进⾏增删改查import pymysql
编程需要学吗?db = t(host='***.***.***.160', user='root', passwd='Ca8th**#Python', db='fusion_media',
charset='utf8mb4',
port=3306)
cur = db.cursor()html5开发软件
# 查询
小沈龙脱口秀全集2020欢乐喜剧人
eclipse导入web项目并运行sql1 = "SELECT data_box FROM t_ai_images WHERE identifying = %s"
cur = db.cursor()
img_data = cur.fetchone() # cur.fetchall()
if img_data[0]:
zljzljzljzljzljzlj日本人视频data_box = img_data[0]
# 插⼊
sql = "INSERT INTO t_ai_images(input_img_url, identifying, status, type) VALUES(%s, %s, 0, 2)"
mysql菜鸟教程增删改查
dbmit()
# 更新
sql_update='''update t_spread_theme_stastic set keyword_num='{}', update_time=now() WHERE theme_id='{}' and keyword='{}'
'''.format(keyword_num,theme_id ,keyword)
connmit()
# 删除
sql = """DELETE FROM student WHERE ID = %s"""%(3)
dbmit()
# 回滚
try:
pass
except:
finally:
db.close()
以上是伪代码,仅作⽰例使⽤

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。