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

Recommended Answers

All 4 Replies

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......

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......

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.

@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
commented: Clears things up. +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.