update_script/check_json.py

29 lines
612 B
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#########################################################################
# File Name: check_json.py
# Created on : 2019-04-18 10:43:28
# Author: Wu Kang
# Last Modified: 2019-04-18 10:55:38
# Description:
#########################################################################
import json
import sys
file=sys.argv[1]
def CheckJson(file):
try:
with open(file, 'r') as f:
load_dict = json.load(f)
except:
print("{} 非json文件!".format(file))
sys.exit(1)
else:
sys.exit(0)
CheckJson(file)