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
(
>
> 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, 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
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 of
>
>
>
> 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 sw
>
> 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 run
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 Py
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/
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
>
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',
>
>
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 py
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 needed
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 ar
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
14 matches
Mail list logo