Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyStreamer(TwythonStreamer):
- def on_success(self, data):
- if data['lang'] == 'en':
- tweets.append(data)
- saveFile = open('twitterDataFile.py','a',encoding='utf-8')
- saveFile.write(str(data))
- saveFile.write('\n')
- saveFile.close()
- return True
- def read_ftweets():
- counter = 0
- with open('twitterDataFile.py','r',encoding = 'ISO-8859-1') as f:
- for line in f:
- counter = counter + 1
- ftweets.append(line)
- #The twitterDataFile file is the file I made to stream tweets into, it was twitterDataFile.txt when it should've been #twitterDataFile.py. Now it works with that code Fiona put on moodle
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement