[Tutor] validation

Michael python at mrfab.info
Mon Aug 27 10:50:02 CEST 2007


Hi

I am fairly new to Python and I wish to validate input. Such as wanting 
to check and make sure that an integer is entered and the program not 
crashing when a naughty user enters a character instead. I have been 
trying to use the Type() function but I cannot work out how to check the 
return value? Caomparing it to 'int' or 'str' isn't working, or should I 
be using the isinstance property? I want to use raw_input and check that 
it is a number. Can someone point me in the right direction?

Thanks

Michael


More information about the Tutor mailing list