Andy Kannberg wrote:
> I tried with the example Peter gave me, and it works. But only when the
> options are boolean. At least, that is my conclusion with experimenting.
> I'll elaborate:
>
> The code to create 'mutually exclusive options':
>
> option_names = [ "l", "o" , "s" ]
> toggled_optio
Hi all,
I tried with the example Peter gave me, and it works. But only when the
options are boolean. At least, that is my conclusion with experimenting.
I'll elaborate:
The code to create 'mutually exclusive options':
option_names = [ "l", "o" , "s" ]
toggled_options = [name for name in option
Andy Kannberg wrote:
> Hi python-guru's,
>
> I am new to Python, coming from a long history of Unix/linux shell
> programming.
> I am creating a Python script (In Python 2.6) which should be able to
> read command line options and arguments.
> So far, I figured out how to do that with optparse.
On 2009-05-20 16:50, Joseph Garvin wrote:
I'm working on a python script that takes several command line flags,
currently parsed by hand. I'd like to change the script to parse them
with OptionParser from the optparse module. However, currently the
script invokes a subprocess, and any flags the s
* Pat (Tue, 27 Jan 2009 14:04:28 -0500)
> >> I had no idea people were going to get so upset that I used a
> >> Windows example and go off on a tear.
> >
> > Nobody is upset, and nobody has "gone off on a tear". The point
> > about the "Windows example" is that the docs say in a
> > close-to-screa
Peter Otten wrote:
> Pat wrote:
>
>> The question was it possible to add a simple flag like 'd-' to optparse
>> with no other parameters?
>
> Do you mean "d-" or "-d"? If the latter, what's wrong with Robert Kern's
> answer?
>
I guess it got crowded out by the prima donnas anxious to help Pat
ph
Peter Otten wrote:
Pat wrote:
The question was it possible to add a simple flag like 'd-' to optparse
with no other parameters?
Do you mean "d-" or "-d"? If the latter, what's wrong with Robert Kern's
answer?
Peter
I mean "-d" since that's what Unix commands expect for flags.
My sole int
Pat wrote:
> The question was it possible to add a simple flag like 'd-' to optparse
> with no other parameters?
Do you mean "d-" or "-d"? If the latter, what's wrong with Robert Kern's
answer?
Peter
--
http://mail.python.org/mailman/listinfo/python-list
I had no idea people were going to get so upset that I used a Windows
example and go off on a tear.
Nobody is upset, and nobody has "gone off on a tear". The point about
the "Windows example" is that the docs say in a close-to-screamingly-
obvious manner that /options are not supported, no ma
* John Machin (Tue, 27 Jan 2009 05:31:42 -0800 (PST))
> Nobody is upset, and nobody has "gone off on a tear". The point about
> the "Windows example" is that the docs say in a close-to-screamingly-
> obvious manner that /options are not supported, no matter what
> religion uses them. It was not, an
On Jan 28, 12:06 am, Pat wrote:
> Thorsten Kampe wrote:
> > * Pat (Mon, 26 Jan 2009 20:02:59 -0500)
> >> Up until today, I never needed to pass any arguments to a Python
> >> program.
> >> [...]
> >> getopt resolved my immediate need, but I would like to know how one
> >> could use optparse to ext
Thorsten Kampe wrote:
* Pat (Mon, 26 Jan 2009 20:02:59 -0500)
Up until today, I never needed to pass any arguments to a Python
program.
[...]
getopt resolved my immediate need, but I would like to know how one
could use optparse to extract out the options from something like "dir
/s /b".
If
If you mean with "/" as the option designator instead of "-": there
doesn't appear to be a documented way of doing it. You would have to
do some social engineering on the users to get them used to doing "dir
-s -b". In any case I thought the number of Windows users who know how
to fire up a Com
* Pat (Mon, 26 Jan 2009 20:02:59 -0500)
> Up until today, I never needed to pass any arguments to a Python
> program.
> [...]
> getopt resolved my immediate need, but I would like to know how one
> could use optparse to extract out the options from something like "dir
> /s /b".
If you actually r
On Jan 27, 12:02 pm, Pat wrote:
> Up until today, I never needed to pass any arguments to a Python program.
>
> I did all the requisite reading and found that I should use optparse
> instead of getopt. I read the documentation and since the words
> "simple" and "easy" often appeared in the examp
> I did all the requisite reading and found that I should use optparse
> instead of getopt. I read the documentation and since the words
> "simple" and "easy" often appeared in the examples and documentation, I
> just knew that it would be a snap to implement.
I don't know where you got that. 'g
On 2009-01-26 19:02, Pat wrote:
Up until today, I never needed to pass any arguments to a Python program.
I did all the requisite reading and found that I should use optparse
instead of getopt. I read the documentation and since the words "simple"
and "easy" often appeared in the examples and do
On Tue, Jan 27, 2009 at 11:02 AM, Pat wrote:
(...)
> What does it take to pass single parameter to a program?
> http://docs.python.org/library/optparse.html stated that programs always
> have options. Is that so? What about "dir /s"?
Sample code:
#!/us
18 matches
Mail list logo