[Python] Flag parser 사용법

Flag parser 사용법

import argparse

parser = argparse.ArgumentParser()
parser.add_argument("-port", "--port", type=int, default=None,
                help='Flask port')
args = parser.parse_args()

print(args.port)

bool사용법

parser.add_argument("-include_top", "--include_top", type=lambda x: (str(x).lower() == 'true'), default=False,
                help='include_top')
RiverZayden

RiverZayden

AI Data Scientist

댓글