python add_argument() 的使用方法

https://www.cnblogs.com/Allen-rg/p/12234237.html

import argparse

parser = argparse.ArgumentParser(description = 'TEST')
parser.add_argument ('--start-epoch', default = 0, type = int, help = 'please input number')
parser.add_argument ('--batch_size', default = 64, type = int, help = ' number')
def main():
    global args
    args = parser.parse_args()

    print(args)
    print(args.start_epoch)

if __name__ == '__main__':
    main()

 

posted @ 2020-06-25 09:25  小娜子成长记  阅读(3156)  评论(0编辑  收藏  举报