I have a file containing lines of something.something(hexvalue1,hexvalue2)
I am trying to convert these hexvalues to binary. From what I researched I figured out I will have to search for hex values in each line and then convert them to binary. I am not sure how to do the search in a string for hex values with other variables in it.
Note : All the lines are in the same format.
When I do :
for line in file:
string = line
string.split('(')
does not split at the ‘(‘
In python, all string methods return new objects (they have to since strings are an immutable type).
str.splitreturns alist. So to parse your string, it would be something like:For those more inclined toward regular expressions: