Mercurial > hg > LGDataverses
comparison scripts/search/json2ids @ 10:a50cf11e5178
Rewrite LGDataverse completely upgrading to dataverse4.0
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 08 Sep 2015 17:00:21 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
9:5926d6419569 | 10:a50cf11e5178 |
---|---|
1 #!/usr/bin/python | |
2 """Find ids in JSON document""" | |
3 import sys | |
4 try: | |
5 import json | |
6 except ImportError: | |
7 import simplejson as json | |
8 import optparse | |
9 parser = optparse.OptionParser(description=__doc__) | |
10 options, args = parser.parse_args() | |
11 | |
12 if not args: | |
13 print "Please supply a filename to process" | |
14 sys.exit(1) | |
15 | |
16 json_data=open(args[0]) | |
17 data = json.load(json_data) | |
18 ids=[] | |
19 for i in data: | |
20 id = i["entityid_l"] | |
21 ids.append(str(id)) | |
22 print ' '.join(ids) | |
23 json_data.close() |