import sqlite3 import os for root, dirs, files in os.walk(r"./"): for f in files: if f.endswith(".db") or ".db" in f: path = os.path.join(root, f) try: conn = sqlite3.connect(path) c = conn.cursor() c.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='QuizQuestions'") if c.fetchone(): c.execute("SELECT COUNT(*) FROM QuizQuestions WHERE category = ?", ("파생상품투자권유자문인력",)) count = c.fetchone()[0] if count > 0: print(f"File: {os.path.relpath(path, r'./')} | Count: {count}") conn.close() except Exception as e: pass