python 使用数据库
2020-04-22 本文已影响0人
小疯伊始
python2
yuminstall-y MySQL-python
onn=MySQLdb.connect(host="127.0.0.1",port=22066,user="root",passwd="123456",db="dsideal_db",charset="utf8")
cursor=conn.cursor()
sql = "select * from test"
n = cursor.execute(sql)
for row in cursor.fetchall():