# coding=utf-8
import pymysql
import os

host="localhost"
user="root"
password="root"
db="exam"

exceptTables=["exam_question_type",'exam_function','exam_admin_group']

conn = pymysql.connect(host=host,user=user,password=password,database=db,charset="utf8")

with conn.cursor() as cursor:
    cursor.execute('show tables')
    rs = cursor.fetchall()
    for row in rs:
        cmd = "TRUNCATE "
        cmd += row[0]
        #print cmd
        if(row[0] in exceptTables):
            continue
        cursor.execute(cmd)

 

相关文章:

  • 2018-12-24
  • 2021-07-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-07
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-21
  • 2022-02-12
  • 2021-06-12
  • 2021-10-07
相关资源
相似解决方案