Сообщество IT-специалистов
Ответы на любые вопросы об IT
Профессиональное развитие в IT
Удаленная работа для IT-специалистов
db = sqlite3.connect(config.database_name) cursor = db.cursor() question = cursor.execute('SELECT question FROM answers') answer = cursor.execute('SELECT right_answer FROM answers') db.commit()
<sqlite3.Cursor object at 0x03B9E7A0>
import sqlite3 import os.path BASE_DIR = os.path.dirname(os.path.abspath(__file__)) db_path = os.path.join(BASE_DIR, "name.db") connection = sqlite3.connect(db_path) cursor = connection.cursor()
import sqlite3 import config import os.path BASE_DIR = os.path.dirname(os.path.abspath(__file__)) db_path = os.path.join(BASE_DIR, f"{config.database_name}") connection = sqlite3.connect(db_path) cursor = connection.cursor() """db = sqlite3.connect(config.database_name) cursor = db.cursor()""" question = cursor.execute('SELECT qustion FROM qustions') answer = cursor.execute('SELECT right_answer FROM qustions') connection.commit() cursor.execute('SELECT question FROM answers') print(answer)