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


Groups > comp.lang.python > #67312

Re: Python : parsing the command line options using optparse

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ganesh1pal@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'handler': 0.05; 'subject:Python': 0.06; 'subject:command': 0.09; 'subject:parsing': 0.09; 'subject:using': 0.09; 'cc:addr:python- list': 0.11; 'inputs': 0.16; 'merged': 0.16; 'subject:options': 0.16; 'to:addr:web.de': 0.16; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'subject: : ': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'message- id:@mail.gmail.com': 0.30; 'lines': 0.31; 'worked': 0.33; 'subject:the': 0.34; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'version': 0.36; 'thanks': 0.36; 'two': 0.37; 'first': 0.61; 'valuable': 0.63
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=A6mubZFvmpPtNvMiehpynJ/JTRYYWxcim3OP7Sc+Whs=; b=Jhf1vswc9TS1RCr4lGjEvkpkqgpytN+9hBqy+/7IxtFUuocTFQs38MzIGJLoOj1xAi BNL5D3B2iHjVjPOe6yR/voBZfOE5eHehloeNK2zHvlghLGRkQpg5NCuQATAQknKNsZHa BheOcIfS5mXu/pVHas1zWfI0Tv3H4VJPG6RIVAPbz16hkmPbsm4CdXsvhX5PEp1+F8Ul jPP6dI2b/NXMDSZds+yv2bENtOrjBJecsDZbI+Uphplz/iiEiZTNGYw+AurTmj2QCb9C kY/owRX+uDCGs5ExbFDc89hPKnVGOpfc2LEWGJNoWCQ1Jd8BZsaEvuQikxjR6V0oGFHr 4uIA==
MIME-Version 1.0
X-Received by 10.112.22.196 with SMTP id g4mr10434254lbf.47.1393675924054; Sat, 01 Mar 2014 04:12:04 -0800 (PST)
In-Reply-To <lesgo6$m9e$1@ger.gmane.org>
References <CACT3xuWuV8omgE6oV0PNGfwdf-yrO3KPbjHtu=B+NHNuOhA_Jw@mail.gmail.com> <leig4s$ri5$1@ger.gmane.org> <CACT3xuUGtsER0B3xwAB2CqQ5Zb=v72w8+DQkaYz681xeSeJ2CQ@mail.gmail.com> <lekj1t$v7n$1@ger.gmane.org> <CACT3xuXWBQC2s2XxE=Cav+RK78voPjbLA0cWSxL50ekktJZ2cg@mail.gmail.com> <CACT3xuXu9m8JY6XVdoJwu+cVKkyYwuBs4iUTF_hVoVks-BQt2A@mail.gmail.com> <lesgo6$m9e$1@ger.gmane.org>
Date Sat, 1 Mar 2014 17:42:03 +0530
Subject Re: Python : parsing the command line options using optparse
From Ganesh Pal <ganesh1pal@gmail.com>
To Peter Otten <__peter__@web.de>
Content-Type multipart/alternative; boundary=14dae9473ba362a79c04f38a769a
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.7510.1393675926.18130.python-list@python.org> (permalink)
Lines 40
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1393675926 news.xs4all.nl 2920 [2001:888:2000:d::a6]:54988
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:67312

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

>
> handler = object_type_dictionary[options.object_type] # look up the
> function
> handler() # call it
>
> The last two lines could also be merged into one
>
> object_type_dictionary[options.object_type]()
>
> but the first version may be clearer.
>
>

Thanks  for your valuable inputs all worked :)

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Python : parsing the command line options using optparse Ganesh Pal <ganesh1pal@gmail.com> - 2014-03-01 17:42 +0530

csiph-web