내용으로 건너뛰기
Out of the Box
사용자 도구
로그인
사이트 도구
검색
도구
문서 보기
이전 판
Fold/unfold all
역링크
최근 바뀜
미디어 관리자
사이트맵
로그인
>
최근 바뀜
미디어 관리자
사이트맵
추적:
argparse
이 문서는 읽기 전용입니다. 원본을 볼 수는 있지만 바꿀 수는 없습니다. 문제가 있다고 생각하면 관리자에게 문의하세요.
====== argparse ====== 임의의 타입 parsing 하기 예) bool <code python> def str2bool(v): if v.lower() in ('yes', 'true', 't', 'y', '1'): return True elif v.lower() in ('no', 'false', 'f', 'n', '0'): return False else: raise argparse.ArgumentTypeError('Boolean value expected.') ... parser.add_argument("--nice", type=str2bool, nargs='?', const=True, default=NICE, help="Activate nice mode.") ... script --nice script --nice <bool> </code> bool 타입 command --feature / command --no-feature 방식 <code python> parser.add_argument('--feature', dest='feature', action='store_true') parser.add_argument('--no-feature', dest='feature', action='store_false') parser.set_defaults(feature=True) </code> * https://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse ===== GUI ===== * https://github.com/chriskiehl/Gooey ===== 대체모듈 ====== * https://pypi.org/project/python-decouple/ {{tag>config args argparse}}
argparse.txt
· 마지막으로 수정됨: 2024/03/23 02:38 저자
127.0.0.1
문서 도구
문서 보기
이전 판
역링크
Fold/unfold all
맨 위로