def str_to_num(text):
    try:
        return int(text)
    except ValueError:
        try:
            return float(text)
        except ValueError:
            return text
Convert a string to a number.
dataset/ETHPy150Open saltstack/salt/salt/utils/__init__.py/str_to_num