:param data: :param file_path: :return:
(data, file_path)
| 22 | class JsonClient(object): |
| 23 | @staticmethod |
| 24 | def dump(data, file_path): |
| 25 | """ |
| 26 | |
| 27 | :param data: |
| 28 | :param file_path: |
| 29 | :return: |
| 30 | """ |
| 31 | if sys.version_info.major == 2: |
| 32 | # python2兼容 |
| 33 | with open(file_path, "w") as fp: |
| 34 | json.dump(data, fp, indent=2, ensure_ascii=False) |
| 35 | else: |
| 36 | # python3兼容 |
| 37 | with open(file_path, "wb") as fp: |
| 38 | fp.write(str.encode(json.dumps(data, indent=2, ensure_ascii=False))) |
| 39 | |
| 40 | @staticmethod |
| 41 | def load(file_path): |