N
N
niggaedition2018-09-15 23:29:44
Python
niggaedition, 2018-09-15 23:29:44

How to get list from vk api response?

There is a server response:

"users": [{
"id": 468363794,
"first_name": "Сенечка",
"last_name": "Мирный",
"invited_by": 468363794,
"type": "profile"
}, {
"id": 241562528,
"first_name": "Данил",
"last_name": "Бессмертный",
"invited_by": 468363794,
"type": "profile"
}, {
"id": 266855437,
"first_name": "Иван",
"last_name": "Смирнов",
"invited_by": 468363794,
"type": "profile"
}

etc.
The question is, how to make a pretty list out of this mess?
Let's say I want to get this:
Senechka Mirny
Danil Bessmertny
Ivan Smirnov
and even better:
[idyid|first name last name]
, etc.
Please explain

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2018-09-15
@niggaedition

spisok = [f'{x["first_name"]} {x["last_name"]}' for x in otvet['users']]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question