Good day. Got a question. I am writing code to collect information on VK group. VK-API returns the answer in the form of a list. There is a need to convert a JSON list into a dictionary. How to actually do this? Here is the code:
import vk import csv session = vk.Session() api = vk.API(session) with open('current_groups_2.csv', 'r') as file1: reader = csv.reader(file1) reader = map(int, file1) group_list = list(reader) while True: for slonik in group_list: if slonik <= max(group_list): pahom = api.groups.getById(group_id=slonik, fields='members_count', c=3) members = api.groups.getMembers(group_id=slonik, offset=10, c=3) print(sorted(pahom)) '\n' print(members) '\n' break Here is an example of the output (returns two lists):
[{'name': '7 ноября | 7teaQUIZ - Интеллектуальная игра', 'photo_medium': 'https://pp.vk.me/c836337/v836337144/8806/MHu2rdmOWrk.jpg', 'type': 'event', 'photo': 'https://pp.vk.me/c836337/v836337144/8807/g9D3aPUWRCw.jpg', 'screen_name': 'game7teaquiz', 'is_closed': 0, 'gid': 130813158, 'photo_big': 'https://pp.vk.me/c836337/v836337144/8805/SKd08w3JXVw.jpg', 'members_count': 64}] {'users': [4616143, 4905583, 5020621, 5075553, 5719830, 6521609, 6656144, 6743475, 6878853, 6943270, 8038966, 8108192, 9020689, 9101839, 9211246, 10642427, 10724272, 11801515, 12339179, 14266378, 14295344, 14733893, 14793302, 15130472, 16634252, 17035575, 17887594, 18730151, 18793031, 19008985, 25636676, 25876136, 28615796, 36896731, 39429003, 39460947, 41406500, 50029265, 53856532, 57557645, 59190909, 63664469, 71634261, 77884116, 97559394, 111169501, 135846191, 153807112, 173184651, 205318641, 225583392, 241450237, 312577254, 320475790], 'count': 64} 