python - i have stored the streaming twitter data in an o1.json file but i am unable to read all tweets -
import json open('o1.json') f: line in f: data=(json.loads(line)) print data["text"]
o1.json contains streaming twitter data, when read data in python object, data type of data object dict, interested in finding value of text key, code give me 1 tweet interested in printing tweets may know how can tweets, working on data science assignment of coursea.org
you're overwriting data
on every iteration of loop, print text after loop finishes - of course you're printing 1 value (the last one). put print statement inside of loop:
import json open('o1.json') f: line in f: data=(json.loads(line)) print data["text"]
Comments
Post a Comment