Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #13082 > unrolled thread

optionparse: how to add a line break to the help text

Started byGelonida N <gelonida@gmail.com>
First post2011-09-10 22:43 +0200
Last post2011-09-10 22:43 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  optionparse: how to add a line break to the help text Gelonida N <gelonida@gmail.com> - 2011-09-10 22:43 +0200

#13082 — optionparse: how to add a line break to the help text

FromGelonida N <gelonida@gmail.com>
Date2011-09-10 22:43 +0200
Subjectoptionparse: how to add a line break to the help text
Message-ID<mailman.949.1315687435.27778.python-list@python.org>
I'm having a small question about optionparse.

Normaly optionparser will format the help text according to the
console's width.

I just wondered if there is any way to insert a line breakk into an
options help text.

Example:

from optparse import OptionParser

parser = OptionParser()
parser.add_option("-f", action="store",
    help="This option is really really complicated"
         " and I'd like to write"
         " a few paragrpahs to explain how it works."
         "\nHowever the line breaks are stripped off"
         " and it's thus difficult to structure the help text")

args = ['-h']
parser.parse_args(args)

Is there any trick to force a new paragraph/ line break before the word
'However'?


Thanks in advance for suggestions.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web