Re: Optparse to parsing Suggestions !!

2014-05-31 Thread Ian Kelly
On May 30, 2014 8:26 AM, "Ganesh Pal" wrote: > > > Hello Python world , > > > I wanted suggestion on how to modify the below code to help me accomodate the below two cases Your question was answered already, but I'd like to point out that optparse is deprecated. If possible, you should use argpar

Re: Optparse to parsing Suggestions !!

2014-05-31 Thread Peter Otten
Am Sa Mai 31 2014, 13:08:12 schrieb Ganesh Pal: >> I think you have to do it manually: >> >> options, args = parser.parse_args() >> >> if options.object == "super_block" and options.path is not None: >> parser.error("Paths not allowed for 'super_block' object") >> >> elif options.object ==

Re: Optparse to parsing Suggestions !!

2014-05-30 Thread Peter Otten
Ganesh Pal wrote: > Hello Python world , > > > I wanted suggestion on how to modify the below code to help me accomodate > the below two cases > > # Here is the Sample code. > > def main(): > """ ---MAIN--- """ > parser = optparse.OptionParser(usage='%prog [options] .]', > version='1.0

Re: Optparse to parsing Suggestions !!

2014-05-30 Thread Ganesh Pal
On Fri, May 30, 2014 at 7:48 PM, Ganesh Pal wrote: > > Hello Python world , > > > I wanted suggestion on how to modify the below code to help me accomodate > the below two cases > > # Here is the Sample code. > > def main(): > """ ---MAIN--- """ > parser = optparse.OptionParser(usage='%pr

Optparse to parsing Suggestions !!

2014-05-30 Thread Ganesh Pal
Hello Python world , I wanted suggestion on how to modify the below code to help me accomodate the below two cases # Here is the Sample code. def main(): """ ---MAIN--- """ parser = optparse.OptionParser(usage='%prog [options] .]', version='1.0') object_choice = ('super_block','block