@swpavlov

В чем моя ошибка?

def test(message):
    subs = '/home/pi/Desktop/bot2.0/subs/all.txt'
    global sub
    sub = [line.rstrip('\n') for line in open(subs, 'rt')]
    for i in sub:
        add_message(
            user_id=i,
            name='нет'
            )
    bot.send_message(permission.subvert, 'Готово')


def add_message(conn, user_id: int, name: str):
    c = conn.cursor()
    c.execute('SELECT * FROM user_message WHERE (user_id IS ?)', (user_id))
    row = c.fetchone()
    if row is None:
        c.execute('INSERT INTO user_message (user_id, name) VALUES (?,?)', (user_id, name))
    conn.commit()


Ошибка: ('Incorrect number of bindings supplied. The current statement uses 1, and there are 9 supplied.',)
  • Вопрос задан
  • 336 просмотров
Решения вопроса 1
aRegius
@aRegius
Python Enthusiast
Кортеж: (user_id) ---> (user_id, )
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы