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


Groups > comp.lang.python > #3589

Re: optparse eats $

From Peter Otten <__peter__@web.de>
Newsgroups comp.lang.python
Subject Re: optparse eats $
Followup-To comp.lang.python
Date 2011-04-19 22:36 +0200
Organization None
Message-ID <iokrp4$7k4$1@solani.org> (permalink)
References <f315a5f9-b11a-48e8-b5ce-1e72dcabc161@glegroupsg2000goo.googlegroups.com>

Followups directed to: comp.lang.python

Show all headers | View raw


tazz_ben wrote:

> So, I'm using optparse as follows:
> 
> Command line:
> python expense.py ">$100" -f ~/desktop/test.txt
> ['>00']
> 
> 
> In Main:
> 
> desc = ''
> p = optparse.OptionParser(description=desc)
> 
> utilities = optparse.OptionGroup(p, 'Utility Options')
> utilities.add_option('--file', '-f', dest="file", help="Define the active
> file to analyze", default='', metavar='"<File Path>"')
> 
> (options, arguments) = p.parse_args()
> 
> print arguments  <- What is becoming ['>00']
> 
> 
> So, any ideas?  Why is including a $ eating both the dollar signa and the
> 1?

It ain't optparse, it's your shell:

$ echo ">$100"
>00
$ echo '>$100'
>$100
$

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar


Thread

optparse eats $ tazz_ben <ben@wbpsystems.com> - 2011-04-19 13:28 -0700
  Re: optparse eats $ John Gordon <gordon@panix.com> - 2011-04-19 20:34 +0000
  Re: optparse eats $ Peter Otten <__peter__@web.de> - 2011-04-19 22:36 +0200

csiph-web