Python中MySQL插入数据

1 sql = 'INSERT INTO course(class_name, credit, properties, teacher_name, college_given, classroom) ' \
2                   'VALUES ("%s", "%d", "%s", "%s", "%s", "%s")' % \
3                   (class_name, credit, properties, teacher_name, college_given, classroom)
4             cursor.execute(sql)
5             conn.commit()

 

posted @ 2017-03-04 13:03  chen狗蛋儿  阅读(3798)  评论(0编辑  收藏  举报