溫馨提示×

python怎么將列表保存到mysql

九三
303
2020-12-03 17:27:31
欄目: 云計算

python怎么將列表保存到mysql

python使用db實現將列表保存到mysql中 

具體方法如下:

import MySQLdb

db=MySQLdb.connect(passwd="moonpie",db="thangs")

c=db.cursor()

c.executemany(

      """INSERT INTO breakfast (name, spam, eggs, sausage, price)

      VALUES (%s, %s, %s, %s, %s)""",

      [

      ("Spam and Sausage Lover's Plate", 5, 1, 8, 7.95 ),

      ("Not So Much Spam Plate", 3, 2, 0, 3.95 ),

      ("Don't Wany ANY SPAM! Plate", 0, 4, 3, 5.95 )

      ] )

0
亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女