Option parser help needed

Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jan 2009
Posts: 19
Reputation: starzstar is an unknown quantity at this point 
Solved Threads: 0
starzstar starzstar is offline Offline
Newbie Poster

Option parser help needed

 
0
  #1
Feb 6th, 2009
Hi

I am using optparser to design a command line interface.How do I read multiple arguments.
For eg if I want to create a folder, I will take the arguments path and folder name something lilke the following

main.py --createFolder Tesfolder --path C://Test/Test/...

How to read these arguments? I can get optparser to work for single argument,like this

c = cfgparse.ConfigParser()
c.add_file('name_dest.ini')
c.add_option('mail_server')
c.add_option('proxy_server', dest='proxy')
opts = c.parse()
but not with multiple args any help is appreciated
thanks
starzstar
Python Fan


Posts: 5
Joined: Tue Jan 20, 2009 4:39 am
Top
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 2
Reputation: keerthihm is an unknown quantity at this point 
Solved Threads: 0
keerthihm keerthihm is offline Offline
Newbie Poster

Re: Option parser help needed

 
0
  #2
Feb 6th, 2009
Hi,

I was doing simple Binary search Program on N elements..
I got a idea to do Testing on this..
Can any one help me has i dont know abt testing..
how many test cases required for 4 elements, has the elements grow till N then how many tests required.... Pls Help me......
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 2
Reputation: keerthihm is an unknown quantity at this point 
Solved Threads: 0
keerthihm keerthihm is offline Offline
Newbie Poster

Re: Option parser help needed

 
0
  #3
Feb 6th, 2009
Pls help me.....
Pls reply 2 my mail id tokeerthi85@gmail.com

Hi,

I was doing simple Binary search Program on N elements..
I got a idea to do Testing on this..
Can any one help me has i dont know abt testing..
how many test cases required for 4 elements, has the elements grow till N then how many tests required.... Pls Help me......
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 122
Reputation: slate is an unknown quantity at this point 
Solved Threads: 30
slate slate is offline Offline
Junior Poster

Re: Option parser help needed

 
0
  #4
Feb 7th, 2009
Maybe I am not alone, but I could not get the problem.
Please provide some simplified cases of what you want to achieve.

Please use code tags and punctuation.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 556
Reputation: Murtan is a jewel in the rough Murtan is a jewel in the rough Murtan is a jewel in the rough Murtan is a jewel in the rough 
Solved Threads: 90
Murtan Murtan is offline Offline
Posting Pro

Re: Option parser help needed

 
1
  #5
Feb 7th, 2009
@starzstar

I think the module you're looking for it getopt

It is designed to parse command line arguments and handles the type you indicated.

@keerthihm

You should probably have started your own thread and not replied to this one.

You seem to be asking about testing a binary tree.
Which are you wanting?
  • help testing a binary tree algorithm
  • help calculating the number of comparisons that must be made when searching a binary tree
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC