Update ticketConf.py

增加指定配置文件运行的参数,这样方便抢来回的车票
pull/200/head
wenqin 2019-01-16 10:22:32 +08:00 committed by GitHub
parent e0fee69e52
commit 59a7e4778e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -9,7 +9,9 @@ def _get_yaml():
解析yaml 解析yaml
:return: s 字典 :return: s 字典
""" """
path = os.path.join(os.path.dirname(__file__) + '/ticket_config.yaml') opts, args = getopt.getopt(sys.argv[1:], 'f:')
config_name = opts[0][1] if opts else 'ticket_config.yaml'
path = os.path.join(os.path.dirname(__file__) + '/' + config_name)
f = open(path) f = open(path)
s = yaml.load(f) s = yaml.load(f)
f.close() f.close()
@ -17,4 +19,4 @@ def _get_yaml():
if __name__ == '__main__': if __name__ == '__main__':
print(_get_yaml()) print(_get_yaml())