Answer the question
In order to leave comments, you need to log in
How to make a separate list for each VK conversation?
I am doing a user blocking command and it is necessary that for each conversation there is a list that contains all blocked users and all IDs of the list must have their own line in the text file where they are saved.
I planned to do it through a dictionary, but it didn't work out:
bans[peer_id] = ban_list = []
bans[peer_id] = ban_list = ban_list.append(reply)
with open('bans.txt','w') as f:
for key,val in bans.items():
f.write('{}:{}\n'.format(key,val))
Answer the question
In order to leave comments, you need to log in
What are you doing these double assignments for? Is it really necessary?
https://docs.python.org/3/library/json.html#json.dump
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question