python 连接 数据库
import pymysqldb = pymysql.connect(host=‘127.0.0.1‘,port=3306,user=‘root‘,password=‘root‘,db=‘odps_test‘, charset="utf8")# # 使用 cursor() 方法创建一个游标对象 cursorcursor = db.cursor()#创建student表Student = ‘‘‘ create table Student( StdID int primary key not null, StdName varchar(100) not null, Gender enum(‘M‘,‘F‘) not null, Age int )‘‘‘cursor.execute(Student)#关闭数据库连接db.close()