bytedancerneat commited on
Commit
839b121
·
verified ·
1 Parent(s): 0eef971

Update util/config_util.py

Browse files
Files changed (1) hide show
  1. util/config_util.py +6 -0
util/config_util.py CHANGED
@@ -5,6 +5,12 @@ import configparser
5
 
6
  ROOT_PATH = os.path.split(os.path.split(os.path.abspath(__file__))[0])[0]
7
 
 
 
 
 
 
 
8
 
9
  def read_config():
10
  config_file = ROOT_PATH + "\conf\config.ini"
 
5
 
6
  ROOT_PATH = os.path.split(os.path.split(os.path.abspath(__file__))[0])[0]
7
 
8
+ def load_json(fp, encoding='utf-8', json_lines=False):
9
+ with open(fp, encoding=encoding) as fin:
10
+ if not json_lines:
11
+ return json.load(fin)
12
+ else:
13
+ return [json.loads(line) for line in fin]
14
 
15
  def read_config():
16
  config_file = ROOT_PATH + "\conf\config.ini"