[Tutor] Force a value to int
kent37 at tds.net
Thu Apr 13 14:06:34 CEST 2006
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):
More information about the Tutor