flags
可以帮助我们通过命令行来动态的更改代码中的参数。
一个demo(节选):
from absl import app, flags, logging
flags.DEFINE_string('type', '','input type.')
flags.DEFINE_integer('index', 0,'input idnex')
FLAGS = flags.FLAGS
print(FLAGS.type)
print(FLAGS.index)
在命令行输入
python test.py --index=0 --type=ps
结果:
ps
0