I have a list of values from a parsed PE file that includes / x 00 zero bytes at the end of each section. I want to remove / x 00 bytes from a string without deleting all "x" from the file. I tried doing .replace and re.sub, but not that success.
Using Python 2.6.6
Example.
import re
List = [['.text\x00\x00\x00'], ['.data\x00\x00\x00'], ['.rsrc\x00\x00\x00']]
while count < len(List):
test = re.sub('\\\\x00', '', str(list[count])
print test
count += 1
>>>tet (removes x, but I want to keep it)
>>>data
>>>rsrc
I want to get the following output
text data rsrc
Any ideas on a better way around this?
source
share