SyntaxFix
Write A Post
Hire A Developer
Questions
Quick and easy, but only for arguments 0 or 1:
parser.add_argument("mybool", default=True,type=lambda x: bool(int(x))) myargs=parser.parse_args() print(myargs.mybool)
The output will be "False" after calling from terminal:
python myscript.py 0