#!/usr/bin/python
# -*- coding: utf8 -*-
import MySQLdb
conn=MySQLdb.connect(host="localhost",user="root",passwd="phpcool",db="device")
cursor=conn.cursor()
cursor.execute("SET NAMES utf8")
cursor.execute("select * from attribute")
cds = cursor.fetchall()
for row in cds:
for r in row:
print r
print 10*"----"
初试Python 操作Mysql
最新推荐文章于 2019-06-11 16:30:00 发布