1 year ago

#331893

test-img

Vinay Vishakanta Murthy

not able to use the hexadecimal value extracted from HTML file using the get iterator option for the arithmetic operations

I have a HTML file which contains a parameter name and its address in hexadecimal, and my requirement here is to read the hexadecimal value and append some offset address for further usage

logic used:

parameters = mylist.getiterator("Parameter")

for parameter in parameters:
       if ( paramerter.attrib.get("name") == "ADDRESS"):
               myAddress = paramter.attrib.get("value")

        myAddress =myAddress + 0x34
        print (myAdress)

If i use the above logic i am getting error as typeError: can only concatenate str (not :"int") to str

if i try to convert the read value to integer and do the addition and convert back to hex using the below method

    myAddress =hex(int(myAddress) +int(0x34))
    print (myAdress)

i am getting value error : invalid literal for int() with base10: '0x156000'

since the value in the HTML file is hex format i am not able to proceed further with this let me know if there are any best ways to solve this

my requirement is to read the hexadecimal address from the HTML and add the offset address and print the same to another text file.

python

html

hex

data-extraction

0 Answers

Your Answer

Accepted video resources