Conversion does not do what expected

 erg_1 = hex(int(ergs[0]))

while ergs[0] is str 7, erg_1 is 0x7 type string, ok so good so far, but
while ergs[0] is str 20, erg_1 shows 0x20 while expected 0x14

What did i misunderstand

Please print each part of the expression what do you see?
For example:

print(ergs[0])
print(int(ergs[0]))
print(hex(int(ergs[0])))

here ist the complete function. If i.e. there are 2 values requested the cli is somecommand.py 22 33. Some command calls that function with:
start_node, end_node = get_cli_params(2,“Usage: ping.py Startnode Endnode”)
and expects two hex equivalents of the input in cli

def get_cli_params(param_count, usage_message):
    """
    get cli input, check for length
    it is assumed that there are max two parameters!
    :param param_count:         number of parameters requested
    :param usage_message:       message to display if parmams not valid
    :returns:                   2 parameters as hex string or ""
    """
    ergs = [0,0]                            # init array to store results from loop
    erg_1 = ""                              # preset first return value
    erg_2 = ""                              # preset second return value
    args = len(sys.argv)                    # get nuber of args, name is counted too
    if args != param_count + 1:             # add 1 for name itself, ergs must be equal param_count + 1
        print(usage_message)                # print usage message
        exit()                              # exit
    for i in range(1,param_count + 1):      # number params OK, loop through parameter
        if sys.argv[i].isnumeric():         # input string has to be numeric
            pass                            # is OK do nothing
        else:                               # if not
            print("Only Numbers allowed")   # print error message
            exit()                          # exit
        ergs[i-1] = int(sys.argv[i], 16)    # save input to array
    if param_count == 1:                    # only one parameter requested
        erg_1 = hex(int(ergs[0]))
    else:
        erg_1 = hex(ergs[0])

        print("ergs[0]")
        print(ergs[0])
        print("int(ergs[0]")
        print(int(ergs[0]))
        print("hex(int(ergs[0]))")
        print(hex(int(ergs[0])))

        erg_2 = hex(int(ergs[1]))
        print(erg_1)
        print(erg_2)
        print(type(erg_1))
        print(type(erg_2))
    exit()
    return erg_1, erg_2

there is still a lot a lot of debug code, including yours, in it

Explain this line to me, what it does and what you expect it to do.

As the parameters are read in a loop I can not put it in the return parameter direct. so I store them in an array temporaly. i-1 why i starts at 1 and array index starts at 0. The array values are copied to the retur parameter at the end

Okay, but what exactly are you storing?

I suspect that this code is over-engineered for what it’s doing. There’s a lot of conversions going on, and I’m not sure you need them all. The line I highlighted is probably a part of your problem, although it could be that it’s correct and your expectations further down need to be adjusted.

what I want to store and I hope I do, is the hex value of the input params.
So i.e if the first input is i.e a string 22, meaning int 22, should return as a byte representing 18.
May be I have a misunderstanding in conversion or or value representation in Python.

This may help. Built-in Functions — Python 3.13.1 documentation

No it doesn’t. It’s 0x14 as expected.