You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

19 lines
487 B

import re
path = r"C:\Users\roger\Desktop\log\wbs_return2021-01-22.log"
with open(path, 'r', encoding='utf-8') as f:
lines = f.readlines()
command_list = []
for line in lines:
if 'ns1="wsdl"' in line:
r = re.search(r'<ns1:(.*?) xmlns:ns1="wsdl">', line)
if r:
result = r.group(1)
# print(result)
command_list.append(result)
command_set = set(command_list)
for c in command_set:
print(c)