Answer the question
In order to leave comments, you need to log in
[AIOGRAM, SQLITE3] How to display the entire database in one message?
Everything needs to be in one message.
if adm_spis == spisbtns[0]:
users = db.db_all()
db_schet = len(users)
users_list = {}
for user in users:
id = user[0]
username = user[1]
user_id = user[2]
number = user[3]
subscription = user[4]
admi = user[5]
blocked = user[6]
ban = user[7]
await msg.answer(f'<b>ВСЯ БАЗА ДАННЫХ </b>\n\n<i>Всего в базе: </i><code>{db_schet}</code>\n\n<b>ID: </b><code>{id}</code>\n<b>USERNAME: </b><code>{username}</code>\n<b>USER_ID: </b><code>{user_id}</code>\n<b>NUMBER: </b><code>{number}</code>\n<b>SUBSCRIPTION: </b><code>{subscription}</code>\n<b>BLOCKED: </b><code>{blocked}</code>\n<b>BAN: </b><code>{ban}</code>\n', parse_mode='html')
ВСЯ БАЗА ДАННЫХ
Всего в базе: 25
#ТУТ ДОЛЖНЫ ВЫВОДИТЬСЯ ОСТАЛЬНЫЕ ЭЛЕМЕНТЫ
ID: 25
USERNAME: YAR_Diana_Kondakova
USER_ID: 837344062
NUMBER: None
SUBSCRIPTION: 0
BLOCKED: 0
BAN: 0
Answer the question
In order to leave comments, you need to log in
users_list
you don't use it anywhere. Why then is it in the code?
for user in users:
id = user[0]
username = user[1]
user_id = user[2]
number = user[3]
subscription = user[4]
admi = user[5]
blocked = user[6]
ban = user[7]
how to write correctly to display everything with html tags
users = [
('Vasya', '12345', '[email protected]'),
('Petr', '7654', '[email protected]'),
('Irina', '142340385', '[email protected]'),
('Solomon', '981234125', '[email protected]'),
]
with_markup = ' '.join(map(lambda x: f'name: {x[0]}\nid: {x[1]}\nemail: {x[2]}', users))
print(with_markup)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question