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

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -