sort of a beginner question about globals
Steven Bethard
steven.bethard at gmail.com
Wed Apr 13 11:34:30 EDT 2005
fred.dixon wrote:
> how would i use the following if OPTIONS was in a module ?
> -----------------------
> from optparse import OptionParser
>
> usage = "usage: %prog [options] arg"
> parser = OptionParser(usage)
>
> parser.add_option("-d", "--debug", ction="store_true", dest="verbose")
> (OPTIONS = parser.parse_args()
Just have this code update the options module:
import options
...
opts, args = parser.parse_args()
options.__dict__.update(opts.__dict__)
STeVe
More information about the Python-list
mailing list