I'm developing a small menu in python where at some point the user is being asked for a float number.
The user could pass:
1.23
1 //it's valid...
23.34e-10 //scientific notation
The user is asked for inserting a float value, if the value is not a float (for example the user could write a generic string...) the program doesn't have to crash but just to re-iterate until the user pass a valid float value. So actually the structure is
var = "";
while(var is not a float):
var = raw_input("");
Does exists a fast way to do that? or should use somehow a regular expression?