Can Python’s optparse display the default value of an option?

Try using the %default string placeholder:

# This example taken from http://docs.python.org/library/optparse.html#generating-help
parser.add_option("-m", "--mode",
                  default="intermediate",
                  help="interaction mode: novice, intermediate, "
                       "or expert [default: %default]")

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)