I am displaying data from a file by using a regular expression. I want to use:
ID=02141592cc0000000700000000000000
ID=02141592cc000000010000000e9489c5
ID=02141592cc0000000500000000000000
ID=02141592cc000000010000000e9489c5
ID=02141592cc0000000400000000000000
ID=02141592cc000000010000000e9489c5
I am using this funtion to extract data:
data = OrderedDict({
'data': r'\b\s\sID=(\w{32})0*',
})
def Extract_List_Data_Info_Based_On_Regular_Expression(Log_File):
# print(re_key)
for re_key in data.keys():
print(re_key)
re_value = data[re_key]
fsrc = open(Log_File, 'r')
buff = fsrc.read()
list_info = re.findall(re_value, buff)
print(list_info)
My goal is to extract data, then modify the last 14 numbers with 0. I want write the modification in the file. For example: this ID=02141592cc000000010000000e9489c5
then I want to modify it it to ID=02141592cc0000000100000000000000