i am searching fo a way to get a Hex Number from a line.
It is a bigger file and i can find the number this way:
The line starts with ".text" (it is the first one which starts with .text). This line contains 3 HexNumbers and i need everytime the second one.
The Problem is that the positions of the numbers are not everytime the same, also the length is not everytime the same.
The line looks like
.text 0x00000 0x4e32 0x11000000
between the numbers there are several spaces, not same everytime.
How can i get and save the 0x4e32 ?
I tried to start like this:
for num, line in enumerate(mapfile, 1):
line = line.rstrip()
if line.startswith('.text '):
foundLine = line
strCheck = "0x"
lineNumber = num
col = foundLine.find(strCheck)+1
print lineNumber, col
index = 0
maxLen = 60
while index < len(line):
index = line.find('0x', index)
if index == -1:
break
print('Code Size found at', index)
index += 2