followers = me.get_followers() following = me.get_following() followers_names = [x.login for x in followers] following_names = [x.login for x in following]
all_is_ok = True# 意思是已是同步状态,无需操作 for user in following_names: is_my_follower = user in followers_names in_always_list = user in ALWAYS_FOLLOW
if (not is_my_follower) and (not in_always_list): me.remove_from_following(g.get_user(user)) print'User \'%s\' has been removed from following list!' % user all_is_ok = False
for user in followers_names: if user notin following_names: me.add_to_following(g.get_user(user)) print'New user \'%s\' has been followed!' % user all_is_ok = False