My code portion looks like:
parser.add_option("-h", "--help","-?",
action = "help",
help= """Print the help of the scipt"""
)
When I am trying to print the options available for the script, it returns an empty array.
optlist = [x.get_opt_string() for x in parser._get_all_options()[1:]]
print optlist
Printing optlist prints an empty array ->
[ ].
I need to print an array with all the available options. In this case, an array that stores values: -h, –help and -?
In python 2.6.5 optparse objects have undocumented attributes _short_opts and _long_opts. For a bumpy list
Using join list of lists in python to flatten the list