Answer the question
In order to leave comments, you need to log in
Why the error?
Hello
Here is the error itself:
File "C:\Users\fyodrro\AppData\Local\Programs\Python\Python38-32\lib\site-packages\telebot\util.py", line 60, in run
task(*args, * *kwargs)
File "bot.py", line 31, in start
user.set_balance(balance=balance)
File "D:\projects\TestInline\db_classes\user.py", line 54, in set_balance
cursor.executemany(request, balance)
TypeError: 'int' object is not iterable
Code(file with functions)
def set_balance(self,balance):
# """Изменяет баланс"""
cursor = self.connect.cursor()
request = f"UPDATE users SET balance=? WHERE id=?"
cursor.executemany(request,balance)
self.connect.commit()
balance = 0
user.set_balance(balance=balance)
Answer the question
In order to leave comments, you need to log in
The second parameter to executemany must be an iterable sequence. The number 0 is not.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question