Skip to content

Instantly share code, notes, and snippets.

@wenming
Created July 25, 2012 22:15
Show Gist options
  • Save wenming/3179040 to your computer and use it in GitHub Desktop.
Save wenming/3179040 to your computer and use it in GitHub Desktop.
parse json
#!/usr/bin/python
import os
import sys
import json
import pprint
file = open("twitter_stream_seq2.txt", 'r')
lines = file.readlines()
i = 0
str = ""
for line in lines:
try:
obj = json.loads(line)
pp = pprint.PrettyPrinter()
pp.pprint(obj)
except ValueError:
print i
i = i + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment