2016-04-19 18:18:45 +08:00
|
|
|
#!/usr/bin/python
|
|
|
|
import json
|
2016-04-21 22:44:36 +08:00
|
|
|
import sys
|
|
|
|
reload(sys)
|
|
|
|
sys.setdefaultencoding( "utf-8" )
|
2016-04-19 18:18:45 +08:00
|
|
|
|
2016-04-21 22:44:36 +08:00
|
|
|
file = open(sys.argv[1])
|
2016-04-23 12:34:35 +08:00
|
|
|
c=0
|
2016-04-22 17:16:06 +08:00
|
|
|
while 1:
|
|
|
|
line = file.readline()
|
|
|
|
if not line:
|
|
|
|
break
|
|
|
|
data = json.loads(line)
|
2016-04-23 12:34:35 +08:00
|
|
|
c+=1
|
2016-04-22 17:16:06 +08:00
|
|
|
print data['time'],data['title'],data['url']
|
2016-04-19 18:18:45 +08:00
|
|
|
|
2016-04-22 17:16:06 +08:00
|
|
|
#data = json.load(file)
|
|
|
|
#c = 0
|
|
|
|
#for article in data:
|
|
|
|
# c+=1
|
2016-04-21 22:44:36 +08:00
|
|
|
# print "[----Time-----]\n",article['time'],article['title']
|
|
|
|
# print "[----Title----]\n",article['title']
|
2016-04-22 17:16:06 +08:00
|
|
|
# print article['time'],article['title']
|
2016-04-21 22:44:36 +08:00
|
|
|
# print "[----Article--]\n",article['content'],"\n\n"
|
2016-04-22 17:16:06 +08:00
|
|
|
|
2016-04-23 12:34:35 +08:00
|
|
|
print c
|