:param file_path: :return:
(file_path)
| 39 | |
| 40 | @staticmethod |
| 41 | def load(file_path): |
| 42 | """ |
| 43 | |
| 44 | :param file_path: |
| 45 | :return: |
| 46 | """ |
| 47 | if sys.version_info.major == 2: |
| 48 | # python2兼容 |
| 49 | with open(file_path, 'r') as rf: |
| 50 | result_json = json.load(rf) |
| 51 | for key, value in result_json.items(): |
| 52 | if isinstance(value, unicode): |
| 53 | result_json[key] = value.encode('utf-8') |
| 54 | else: |
| 55 | # python3兼容 |
| 56 | with open(file_path, 'r', encoding="utf-8") as rf: |
| 57 | result_json = json.load(rf) |
| 58 | |
| 59 | return result_json |
no outgoing calls
no test coverage detected