def convert_to_int(s):
    try:
        nr = int(s)
    except (ValueError, TypeError):
        nr = 0

    return nr
Convert string to integer
dataset/ETHPy150Open farshield/pathfinder/src/pathfinder/model/tripwire.py/convert_to_int