Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'example:': 0.03; 'args': 0.05; 'parser': 0.05; 'suggestions.': 0.07; 'optparse': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'width.': 0.09; 'stripped': 0.16; 'advance': 0.18; 'insert': 0.19; 'subject:help': 0.22; 'structure': 0.23; 'thus': 0.23; 'breaks': 0.23; 'wondered': 0.23; "i'm": 0.27; 'import': 0.28; 'thanks': 0.30; 'break': 0.32; 'there': 0.33; 'to:addr:python-list': 0.33; 'header:User-Agent:1': 0.34; 'force': 0.34; 'header:X-Complaints- To:1': 0.35; 'subject:text': 0.35; 'explain': 0.36; 'question': 0.36; 'options': 0.37; 'received:org': 0.38; 'subject:: ': 0.39; 'difficult': 0.39; 'option': 0.39; 'help': 0.39; 'header:Mime- Version:1': 0.39; 'to:addr:python.org': 0.39; "i'd": 0.40; "it's": 0.40; 'according': 0.62; 'subject:line': 0.73; 'off"': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Gelonida N Subject: optionparse: how to add a line break to the help text Date: Sat, 10 Sep 2011 22:43:39 +0200 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: unicorn.dungeon.de User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.21) Gecko/20110831 Lightning/1.0b2 "" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1315687435 news.xs4all.nl 2441 [2001:888:2000:d::a6]:42976 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:13082 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.