I want to have some options in argparse module such as --pm-export
however when I try to use it like args.pm-export
I get the error that there is not attribute pm
. How can I get around this issue? Is it possible to have -
in command line options?
As indicated in the argparse
docs:
For optional argument actions, the value of dest is normally inferred from the option strings. ArgumentParser generates the value of dest by taking the first long option string and stripping away the initial
--
string. Any internal-
characters will be converted to_
characters to make sure the string is a valid attribute name
So you should be using args.pm_export
.