模組:MySQLdb
官網:http://sourceforge.net/projects/mysql-python/
安裝:pip install MySQL-python
用法:
http://drizzlewalk.blog.51cto.com/2203401/448874
範例:
db = MySQLdb.connect(host="localhost", user="root", passwd="12345678", db="yugioh")
db.set_character_set('utf8')
cursor = db.cursor()
sqlcommand = "INSERT INTO `yugioh`.`yugioh` (`number`, `name`, `day`, `cheap`, `top`) VALUES ('aa', 'bb', 'cc', 'dd', 'ee')"
cursor.execute(sqlcommand)
db.commit()
沒有留言:
張貼留言