Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data.json
- [{"need_key": {"pri": ["outpatient_visit_id", "inpatient_visit_id"], "sub": "visit_id"}, "match_rules": [{"pri": ["visit_datetime", "admit_datetime"], "sub": ["create_application_datetime"]}], "principal_table": ["tbl_reg_registrations", "tbl_adt_admits_discharges"], "subordinate_table": "tbl_std_studies", "need_yidu_vid": "yes", "common_key": {"pri": "patient_id", "sub": "patient_id"}}]
- 如果你要处理的是文件而不是字符串,你可以使用 json.dump() 和 json.load() 来编码和解码JSON数据。例如:
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import json
- import os,sys
- with open('data.json', 'r') as f:
- data = json.load(f)
- print(data[0]["need_yidu_vid"])
- # Writing JSON data
- with open('data.json', 'w') as f:
- json.dump(data, f)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement