Ed Singleton wrote:
> Is there a particular way to force a value to be an int by either
> converting it with int() or returning a default value.
>
> I've ended up writing my own function to do it, but it seems like the
> kind of thing that would be built-in somewhere.
No, there is no built-in for this but it's easy to write your own:
def my_int(value, default):
try:
return int(value)
except ValueError:
return default
Kent
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor