1
1
import twitter
2
-
3
-
2
+
3
+
4
4
TWITTER_CONSUMER_KEY = 'XXX'
5
5
TWITTER_CONSUMER_SECRET = 'XXX'
6
6
TWITTER_ACCESS_TOKEN_KEY = 'XXX'
7
7
TWITTER_ACCESS_TOKEN_SECRET = 'XXX'
8
-
8
+
9
9
twitter_api = twitter .Api (
10
10
consumer_key = TWITTER_CONSUMER_KEY ,
11
11
consumer_secret = TWITTER_CONSUMER_SECRET ,
12
12
access_token_key = TWITTER_ACCESS_TOKEN_KEY ,
13
13
access_token_secret = TWITTER_ACCESS_TOKEN_SECRET
14
14
)
15
-
15
+
16
16
if __name__ == '__main__' :
17
17
follower_ids = twitter_api .GetFollowerIDs ()
18
18
following_ids = twitter_api .GetFriendIDs ()
19
- zombie_follows = [following_id for following_id in following_ids if following_id not in follower_ids ]
20
-
21
- confirm = raw_input ("Are you sure you want to unfollow %s tweeps [y|n]? " % (len (zombie_follows )))
19
+ zombie_follows = [following_id for following_id in
20
+ following_ids if following_id not in follower_ids ]
21
+
22
+ confirm = raw_input (
23
+ "Are you sure you want to unfollow {0} tweeps [y|n]? " .format (
24
+ (len (zombie_follows ))))
22
25
if confirm .lower ()== 'y' :
23
26
for id in zombie_follows :
24
27
user = twitter_api .DestroyFriendship (user_id = id )
25
- print "Unfollowed%s" % (user .screen_name )
28
+ print ( "Unfollowed{0}" . format (user .screen_name ) )