Computer Science, asked by ambicaparasa7257, 1 year ago

How to handle invalid arguments with argparse in Python?

Answers

Answered by nishitadeka82
2

HOLA BUDDY.....

\huge\pink{Answer:---}

I use argparse to parse command line arguments and by default on receiving invalid arguments it prinmts help message and exits.

#foo.py

import argparse

parser = argparse.ArgumentParser()

parser.add_argument("echo")

args = parser.parse_args()

#hope it helps you....

Plzz mark it as brainliest.... ^·^


Anonymous: sorru
Anonymous: sorry
Answered by Anonymous
2

Hello Mate,

I use argparse to parse command line arguments and by default on receiving invalid arguments it prinmts help message and exits.

#foo.py

import argparse

parser = argparse.ArgumentParser()

parser.add_argument("echo")

args = parser.parse_args()

Hope this helps you

Similar questions