Question about 'if __name__ == "__main__":'

Hakan Nilsson hakan at netg.se
Tue Feb 3 03:57:00 EST 2004


On Tue, 3 Feb 2004, PoD wrote:

> On Mon, 02 Feb 2004 23:33:42 -0800, Amy G wrote:
>
> > I have a program that needs a little help.
> > Right now the program runs in my crontab.  When it runs, it sets a few
> > variables based on a query to a MySQL database.  I would like to modify it
> > so that it can run as it is... or if arguments are supplied, use those
> > instead of querrying the database.
> >
>
> Hint: len(sys.argv)
>

You might want to check out the getopt module too:

http://www.python.org/doc/current/lib/module-getopt.html

Depends on how many arguments you are planning to support I guess.

/h

-
 Hi! I'm a .signature virus!
 Copy me into your .signature file to help me spread!





More information about the Python-list mailing list