Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #67086
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.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.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'skip:[ 20': 0.04; 'subject:Python': 0.06; 'error:': 0.07; 'upgraded': 0.07; 'optparse': 0.09; 'subject:command': 0.09; 'subject:parsing': 0.09; 'subject:using': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '2.7': 0.14; "'set',": 0.16; 'accepts': 0.16; 'fine.': 0.16; 'subject:options': 0.16; 'to:addr:web.de': 0.16; 'wrote:': 0.18; 'module': 0.19; 'skip:f 30': 0.19; 'feb': 0.22; 'machine': 0.22; 'cc:addr:python.org': 0.22; 'install': 0.23; 'conjunction': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'options': 0.25; 'script': 0.25; 'subject: : ': 0.26; 'asking': 0.27; 'header:In-Reply-To:1': 0.27; 'host': 0.29; 'message-id:@mail.gmail.com': 0.30; '25,': 0.31; 'probably': 0.32; 'skip:c 30': 0.32; 'option': 0.32; 'run': 0.32; 'subject:the': 0.34; 'could': 0.34; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'version': 0.36; '2.6': 0.36; 'possible': 0.36; 'starting': 0.37; 'machines': 0.38; 'skip:- 10': 0.38; 'pm,': 0.38; 'short': 0.38; 'does': 0.39; '8bit%:6': 0.40; 'eventually': 0.60; 'new': 0.61; 'love': 0.65; 'here': 0.66; 'sample': 0.67; 'dont': 0.67; 'invalid': 0.68; 'hand': 0.80; 'freebsd': 0.84; 'otten': 0.84 |
| 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=6VECKXAfAbFyqxi6/AWFj+kv1MOEVO5oO+jK4WtUP5M=; b=ytFqVJ0l0VdvDE0EBhFfHHaZlSFXXCKsZ/+vJ9D+gK9sfBBJyiy1p5eItUtejA0i4E 6BdbXaztlwMp5QrQ3uA4zh9bGlLCqFY6T15zjGAK1OlGkNT2W0Rr4jQA8U3wg+WcadpT 1QEgx97BWCoF8kPgCRje2ggpD/A57GAJRGe83a+X8bKXlFL05ZP7opnZ4yYsQTc/G/YD kI4Qz5P8XZQGON55kRzhZAjobz+Ci2O9pH//6tJ/ISu9mYUsghSrXFmuB7vShT+EGqtj N6rgiYwWDOOd7z9WMgbFnxqckSx7V1mMvBiLZH+7XFsgSVazedpi/mzH1m6hAxknuumm rnTg== |
| MIME-Version | 1.0 |
| X-Received | by 10.112.164.5 with SMTP id ym5mr977284lbb.48.1393407021448; Wed, 26 Feb 2014 01:30:21 -0800 (PST) |
| In-Reply-To | <leig4s$ri5$1@ger.gmane.org> |
| References | <CACT3xuWuV8omgE6oV0PNGfwdf-yrO3KPbjHtu=B+NHNuOhA_Jw@mail.gmail.com> <leig4s$ri5$1@ger.gmane.org> |
| Date | Wed, 26 Feb 2014 15:00:21 +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=001a11c268188a83d504f34bda8b |
| 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.7386.1393407329.18130.python-list@python.org> (permalink) |
| Lines | 122 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1393407329 news.xs4all.nl 2916 [2001:888:2000:d::a6]:34041 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:67086 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
On Tue, Feb 25, 2014 at 9:55 PM, Peter Otten <__peter__@web.de> wrote: >As you are just starting I recommend that you use argparse instead of optparse. I would love to use argparse but the script that I plan to write has to run on host machines that Python 2.6 I have freebsd clients with python 2.6 dont want to install python new version on all the host machine which will be eventually upgraded to 2.7 . I wanted know if I could use argparse with python 2.6 and is it possible to add something like #pkg_add -r install python-argparse and install python argparse module before I use it. > >If you are asking why short options don't work in conjunction with = -- I > >don't know, it is probably a design choice of the optparse author. > >argparse accepts short options with like -f=1234 > I wanted to know why my sample program does not work with short hand option (-p) and works with long hand option . Here is what is happening ( only short hand with -) # python-5.py -p=/ifs/1.txt -q=XOR -f=1234 -n=1 -l Usage: python-5.py [options] python-5.py: error: option -q: invalid choice: '=XOR' (choose from 'XOR', 'ADD', 'SET', 'MODIFY', 'RENAME', 'DELETE', 'KILL') Result :says invalid choice: '=XOR' Long hand Works ( -- , or double hypen ) fine. C:\Users\bahadg\Desktop>python python-5.py --path=/ifs/1.txt --operation=XOR -- offset=1234 --node=1 --log --fixcrc /ifs/1.txt
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Python : parsing the command line options using optparse Ganesh Pal <ganesh1pal@gmail.com> - 2014-02-26 15:00 +0530 Re: Python : parsing the command line options using optparse sffjunkie@gmail.com - 2014-02-26 02:55 -0800
csiph-web