On Sun, 2009-06-07 at 00:54 +0200, Sander Sweers wrote:
> 2009/6/6 Nick Burgess <burgess.n...@gmail.com>:
> > Is it posible to take
> > the regex compile from user input?  To make it take an argument,  like
> >
> >> csvSearch.py 10.192.55
> 
> You can use raw_input() see [1] for the docs
>   user_input = raw_input('Please provide input')

Ugh, I really should not write e-mail 2 in the morning.... :(

What you are looking for is command line options. Command line options
are stored in sys.argv, see [1].

import sys
opts = sys.argv[1:] #sys.argv[0] is filename
print opts

You will need to validate the input so your module does not raise an
exception.

If you are planning to do more advanced commandline options you should
look at the optparse module [2].

Greets
Sander

[1] http://docs.python.org/library/sys.html#sys.argv
[2] http://docs.python.org/library/optparse.html

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to