将JSON文件作为Python的配置文件,读取和使用的写法 import osimport json#获取配置path os.getcwd() os.sep config.jsonconf Nonewith open(path, r, encodingutf-8) as f:if conf is None:conf json.loads(f.read())heard {_token: f{conf[token]}}