py
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user