def fint(str_val):
    """ try to convert to int, then float if fails, then return None. """
    for f in [int, float]:
        try:
            return f(str_val)
        except (ValueError, TypeError):
            pass
