def range_value(val, limit):
    """
    验证给定值是否在范围内,先转换为数值比较，如果转换不成功，则转换为字符串比较
    :param val:
    :param limit:
    :return:
    """
    if (isinstance(limit, tuple) or isinstance(limit, list)) and len(limit
        ) == 2:
        try:
            a, b, c = int(limit[0]), int(val), int(limit[1])
        except ValueError:
            a, b, c = str(limit[0]), str(val), str(limit[1])
        return a <= b <= c
    return False
