obspy.core.util.misc.to_int_or_zero

to_int_or_zero(value)[source]

Converts given value to an integer or returns 0 if it fails.

Parameters:

value – Arbitrary data type.

Return type:

int

Example

>>> to_int_or_zero("12")
12
>>> to_int_or_zero("x")
0