0

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.

D.L
  • 4,339
  • 5
  • 22
  • 45
  • Maybe [this answer](https://stackoverflow.com/a/209550/16775594) will help you. – Sylvester Kruin Mar 24 '22 at 20:52
  • "since the value in the HTML file is hex format" - can you please provide an example and an explanation of why you think the 'parameter name' and 'address' are 'in hexadecimal'? (also, there's a typo in your example, `paramter` - so it's probably not actually the code you're using) – Grismar Mar 25 '22 at 00:59

0 Answers0