python操作mysql数据库
# -*- coding: utf-8 -*-
import pymysql
conn= pymysql.connect(host="localhost",user="root",passwd="admin",db="local_db",charset="utf8")
cursor = conn.cursor()
n = cursor.execute("select * from course")
for row in cursor.fetchall():
for r in row:
print (r)
print(n)
cursor.close()
conn.close()