Answer the question
In order to leave comments, you need to log in
How to output multiple sqlite lines in one vk py message?
I wrote a small code that allows you to get all the information about users in the database. The output of messages works fine, but one thing bothers me. The function itself displays information in each new message, that is, one message per user. I need to be able to display everything in one message by the VKontakte bot. How can I do that? I would be grateful for the help
The code itself:
def vivod_inf():
for i in sql.execute(f"SELECT id,nick,dostyp FROM users"):
write_message(sender, f"{i[0]}({i[1]}), уровень доступа - {i[2]}")
Answer the question
In order to leave comments, you need to log in
def vivod_inf():
o = ""
for i in sql.execute(f"SELECT id,nick,dostyp FROM users"):
o += f"{i[0]}({i[1]}), уровень доступа - {i[2]}\n"
write_message(sender, o)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question