Thanks Peter and Simon for the hints it worked : ) without ' ='
# Python corrupt.py -o INODE -p /ifs/1.txt -q SET -f 1
Current Default Choice :
Choice: INODE
Choice: SET
Choice: 1
Iam done with the command line parsing but got stuck while trying to
implement switch kind of
Ganesh Pal wrote:
Iam using the options.name directly for manipulations is this fine or do
I need to assign it to variable and then use it
if options.object_type == 'LIN':
corrupt_inode()
This is fine. You would only consider storing the value if you are going to
use it very often
On Sat, 01 Mar 2014 16:43:11 +0530, Ganesh Pal wrote:
Iam done with the command line parsing but got stuck while trying to
implement switch kind of behavior with dictionaries. So posting 2 more
questions
You should start new threads for new questions. The subject line here has
nothing to do
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 :)
--
On Sat, Mar 1, 2014 at 5:17 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
You should start new threads for new questions. The subject line here has
nothing to do with the questions you ask.
Sure Steven and thanks for replying and your suggestion for Question 2
( same
They must be running an older version of FreeBSD since the default version
of python is 2.7.
There is a FreeBSD package for argparse, the command would be something
like
pkg_add -r install py26-argparse
Rod
Yes Iam running a older version of FreeBSD ( Iam actually running a
On Tue, Feb 25, 2014 at 9:55 PM, Peter Otten __pete...@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
On Wednesday, 26 February 2014 09:30:21 UTC, Ganesh Pal wrote:
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',
Ganesh Pal wrote:
On Tue, Feb 25, 2014 at 9:55 PM, Peter Otten __pete...@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
On Wed, Feb 26, 2014 at 4:57 PM, Peter Otten __pete...@web.de wrote:
If you stick with optparse just pass the options without '='
-qXOR
and
-q XOR
should both work.
Thanks Peter and Simon for the hints it worked : ) without ' ='
# Python corrupt.py -o INODE -p /ifs/1.txt -q SET
On 2014-02-26 04:30, Ganesh Pal wrote:
On Tue, Feb 25, 2014 at 9:55 PM, Peter
Otten __pete...@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
Hi Folks ,
Iam newbie to Python, Iam trying to use optparse module and write a script
that will parse the command line options ..I had to use opt parse instead
of argparse because by host Operating system is still using python 2.6
Below is the simple program ( Feel free to correct the error
Ganesh Pal wrote:
Iam newbie to Python, Iam trying to use optparse module and write a script
that will parse the command line options ..I had to use opt parse instead
of argparse because by host Operating system is still using python 2.6
As you are just starting I recommend that you use
On 25/02/2014 15:31, Ganesh Pal wrote:
Hi Folks ,
Iam newbie to Python, Iam trying to use optparse module and write a
script that will parse the command line options ..I had to use opt parse
instead of argparse because by host Operating system is still using
python 2.6
Do you have the
A shell script is passing parameters to my python script in the
following format
-PARAM1 12345 -PARAM2 67890
Can I parse these with optparse ? If so how?
I can't seem to get it to work. It seems to expect --PARAM1 and --
PARAM2
--
http://mail.python.org/mailman/listinfo/python-list
loial wrote:
A shell script is passing parameters to my python script in the
following format
-PARAM1 12345 -PARAM2 67890
Can I parse these with optparse ? If so how?
I can't seem to get it to work. It seems to expect --PARAM1 and --
PARAM2
You are out of luck. Quoting
loial jldunn2...@googlemail.com (L) wrote:
L A shell script is passing parameters to my python script in the
L following format
L -PARAM1 12345 -PARAM2 67890
L Can I parse these with optparse ? If so how?
L I can't seem to get it to work. It seems to expect --PARAM1 and --
L PARAM2
See the
In article b0195ff6-7dc1-42eb-819c-5b5b5a9bb...@g1g2000yqh.googlegroups.com,
loial jldunn2...@googlemail.com wrote:
A shell script is passing parameters to my python script in the
following format
-PARAM1 12345 -PARAM2 67890
Can I parse these with optparse ? If so how?
You might try using
18 matches
Mail list logo