scanning for numerals / letters

Kun neurogasm at gmail.com
Tue Apr 18 20:34:07 EDT 2006


I have the following if statement that checks if a form is empty:

     if form.has_key("date") and form["date"].value != "":
         date=form['date'].value

     else:
         print "ERROR: No date entered!"
         raise Exception

I would also like to add another if statement checking if 'date' has any 
letters (a-z) in it, and if so, would like to say that "you have to 
enter a date with numbers".  I am not sure how to alter my current if 
statement to do that check so any assistance would be appreciated.


On the flip side, I also have a field called 'purchases' where the user 
must enter non-numerals, thus i would also like to know how to scan to 
see if their entry has numerals and print 'please do not use numbers' if 
they did.

Thanks for your help.



More information about the Python-list mailing list