parser.has_options(...)

Jeremy Conlin <[email protected]> Mon, 21 Jun 2004 20:24:15 -0400
Newsgroups gmane.comp.python.optik.user
Message-ID <[email protected]>
I am writing another script using optparse because I have found it very 
helpful.  I would like to know if the user has specified an option.  If 
the user has specified an option and given it a value, I want to do 
something different.  This is what I have, but it doesn't work.

parser = OptionParser(usage=usage, version='Version #:%s' %Version)
parser.add_option("-C", "--Cool", type="float", default=False,
                     help='Coolest Temperature in Fuel Region')
parser.add_option("-H", "--Hot", type="float", default=False,
                     help='Hottest Temperature in Fuel Region')
...

if parser.has_option('-C'):
     print 'Cool Temperature was specified %.3f' %options.Cool
     print 'Enter Cool Temperature code here:'
if parser.has_option('H'):
     print 'Hot Temperature was specified %.3f' %options.Hot
     print 'Enter Hot Temperature code here:'

Any suggestions?
Thanks,
Jeremy Conlin