]> projects.mako.cc - twitter-api-cdsw-solutions/commitdiff
fixed bugs and python3 updates for the twitter projects
authorBenjamin Mako Hill <mako@atdot.cc>
Tue, 5 May 2015 00:15:57 +0000 (17:15 -0700)
committerBenjamin Mako Hill <mako@atdot.cc>
Tue, 5 May 2015 00:15:57 +0000 (17:15 -0700)
twitter2.py
twitter4.py

index 89f03fabebc2b99661ce5f29dc6973e4e1d09a18..6d67a0f3e687c6ca911044001564525478e6b4d7 100644 (file)
@@ -13,6 +13,6 @@ print(user.screen_name + " has " + str(user.followers_count) + " followers.")
 
 print("They include these 100 people:")
 
-for friend in user.friends(count=100):
+for friend in user.followers(count=100):
    print(friend.screen_name)
 
index 918b565b37fa8af34b11efd8339c5f6dcf25c0a5..3030edf456d98aae05a5f76af8e9da2e1d965b72 100644 (file)
@@ -8,8 +8,7 @@ auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
 api = tweepy.API(auth)
 
 # code to write the file
-import codecs
-output_file = codecs.open("MY_DATA.tsv", "w", "utf-8")
+output_file = open("MY_DATA.tsv", "w", encoding="utf-8")
 
 public_tweets = api.search("data science", count=10)
 

Benjamin Mako Hill || Want to submit a patch?