Answer the question
In order to leave comments, you need to log in
How to get the answer from one file to another file?
How to transfer the response about the performed operation from the db.py file to another filr.py?
def add_message(conn, user_id: int, name: str):
c = conn.cursor()
c.execute('SELECT * FROM user_message WHERE (user_id IS ? AND name IS ?)', (user_id, name))
row = c.fetchone()
if row is None:
c.execute('INSERT INTO user_message (user_id, name) VALUES (?,?)', (user_id, name))
conn.commit()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question