I am trying to create a program that takes a string IPv4 address and converts it to a hexadecimal integer. My program works, however the hexadecimal value is in the form of a string, so my program returns value errors (eg: "invalid literal for int() with base 10", or "expected type int() or float()...").
example input: 115.255.8.97
example output: 73FF0861
#IPv4 to Hex
splitip = sys.argv[2].split('.')
hexint = hex(int(splitip[0]))[2:].zfill(2) + hex(int(splitip[1]))[2:].zfill(2) + hex(int(splitip[2]))[2:].zfill(2) + hex(int(splitip[3]))[2:].zfill(2)
hexint = hexint.replace('0x','')
Any help would be appreciated!
Note: My problem is that the hexint variable is a string. My program needs to have the value ad an integer.