-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfollowback.py
30 lines (24 loc) · 860 Bytes
/
followback.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import json
# open and save files
with open("followers.json", "r") as f:
followers = json.load(f)
with open("following.json", "r") as f:
following = json.load(f)
# create empty sets
followers_set = set()
following_set = set()
# save a set of all followers
for person in followers["relationships_followers"]:
person = person["string_list_data"][0]["value"]
followers_set.add(person)
# save a set of all following
for person in following["relationships_following"]:
person = person["string_list_data"][0]["value"]
following_set.add(person)
# find the difference between the lists
not_following = following_set.difference(followers_set)
# print the users not following back
print(str(len(not_following)) + " are not following you back.")
not_following = sorted(not_following)
for username in not_following:
print("@" + username)