A
A
Artem Marsh2018-11-11 20:51:24
Python
Artem Marsh, 2018-11-11 20:51:24

How to do an iteration?

Another question:
How can I iterate here?

def group_members():
    group = vk.groups.getMembers(group_id=164445012, fields=['first_name, last_name, online'])
    name = group['items'][0]['first_name']
    lname = group['items'][0]['last_name']
    online = group['items'][0]['online']
    iduser = group['items'][0]['id']
    if online == 0:
        online = 'Не в сети'
    else:
        online = 'В сети'
    print('|', name, lname, '|', 'id' + str(iduser), '|',  '==>', online)

I tried to do something with the increase, but I only got 2 users and that's it.
VC response:
{'count': 18, 'items': [{'id': xxxxx, 'first_name': lol', 'last_name': 'loles', 'online': 0}, {'id': xxxxx , 'first_name': 'loles, 'last_name': 'lol', 'online': 0}...
No need to kick me with your answers like: Yes, you are a cancer, learn python, etc.
Please help, turn in the work very soon!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question