W
W
Wet_Dumplings2018-06-29 19:41:02
Python
Wet_Dumplings, 2018-06-29 19:41:02

How to get a list of VK community members and write it to CSV?

Hey!
You need to get a list of community members (for example, this one - https://vk.com/stopgameru)
I created the following request:

list_m = vkapi.groups.getMembers(group_id="stopgameru", count=3,fields='city',v=5.80)

print output:
{'count': 150312, 'users': [{'id': 1185, 'first_name': 'Andrey', 'last_name': 'Pronin'}, {'id': 1586, 'first_name': 'Dominik' , 'last_name': 'Smith'}, {'id': 1699, 'first_name': 'Maxim', 'last_name': 'Mernes', 'city': {'id': 1707102, 'title': 'Singapore '}}]}

When you try to write it, either everything is written in one cell or (when using delimiter, it fills 2 cells of the column with `count` and `users`)
How to write this list to CSV in the form:
[id] [first_name] [last_name] [city ]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AVKor, 2018-06-29
@AVKor

Parse JSON and write the result to CSV.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question