123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- import codecs
- import re
- import json
- fw=codecs.open('c:/tmp/result.json','w','utf-8')
- content=""
- fr=codecs.open('c:/tmp/ot.json','r','utf-8')
- lines=fr.readlines()
- for l in lines:
- newl=l.replace('\\"','"')
- content+=newl
- result=re.search(r'\[\["',content)
- content_begin=result.start()
- result=re.search(r'\]\]"',content)
- content_end=result.end()
- #print(result.span(1))
- #print(result.span(2))
- #for r in result:
- # print(r)
- #r=result[0]
- #print(r)
- #print(result)
- fw.write(content[content_begin:content_end-1])
- fw.close()
- jscontent=content[content_begin:content_end-1]
- jsobj=json.loads(jscontent)
- print()
- for x in jsobj[0][1][1:]:
- # print(x[14][0])
- print(x[14][11])
- print(x[14][10])
- print(x[14][2])
- print(x[14][78])
- # cnt=0
- # for xx in x[14]:
- # cnt+=1
- # if 'ChIJ' in str(xx):
- # print(xx)
- # print(cnt)
- # print(x[14][9])
- # try:
- # print(x[14][4][3])
- # except:
- # print(x[14][4])
|