Python之旅 2·Python创建MySQL
import pymysql conn = pymysql.connect(host='127.0.0.1', user='root', password='123', db='videos', charset='utf8') cursor = conn.cursor() # 建立存放电影数据的表doubanfilm6,名字自取 sql = """create table if not exists movies (film_addr varchar(1000), cover_pic varchar(1000), name varchar(100) primary key,\ ori_name varchar(100),prod_year varchar(100), prod_country varchar(100), category varchar(100), language varchar(100), \ subtitle varchar(100), release_date varchar(100), score varchar(100), file_format varchar(100), video_size varchar(100), \ file_size varchar(100), film_length varchar(100), director varchar(100), actors varchar(500), profile varchar(2000),capt_pic varchar(1000))""" cursor.execute(sql) cursor.close() conn.close()
我们不是一群默默无闻的码农,而是推进世界进步的开荒者