displaying newlines in the help message when using python's optparse -


i'm using optparse module option/argument parsing. backwards compatibility reasons, can't use argparse module. how can format epilog message newlines preserved?

in below example, i'd epilog printed formatted.

    epi = \ """ examples usages:     %prog -a -b foo   else   %prog -d -f -h bar """     parser = optparse.optionparser(epilog=epi) 

see first answer at:

python optparse, how include additional info in usage output?

the basic answer subclass optionparser

class myparser(optparse.optionparser):     def format_epilog(self, formatter):         return self.epilog 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -