Files
QUZ/inspect_db.py
T
root 4c2ce929d9 py
2026-06-27 02:21:09 +00:00

12 lines
455 B
Python

import sqlite3
import json
db_file = r'./qple_quiz.db'
conn = sqlite3.connect(db_file)
conn.row_factory = sqlite3.Row
cursor = conn.cursor()
cursor.execute("SELECT question_text, choice1, choice2, choice3, choice4, correct_answer_str, raw_json FROM QuizQuestions WHERE correct_answer_str = '' OR length(correct_answer_str) <= 1 LIMIT 5;")
rows = [dict(row) for row in cursor.fetchall()]
print(json.dumps(rows, ensure_ascii=False, indent=2))
conn.close()