Closed probonopd closed 3 years ago
We must not use things like
https://github.com/helloSystem/Utilities/blob/265fe66c156d1debfeb5c8444b646db99fee053e/Developer%20Preview/Network.app/Network#L143-L148
where we hardcode the number of characters.
We need to use a regex instead.
This regex can parse the output correctly:
import re regex = r"((?:[0-9A-Fa-f]{2}[:-]){5}(?:[0-9A-Fa-f]{2}))\ +([0-9]+)\ +(-[0-9]*)\ +([^\ ]+)\ +(.*?)\n" matches = re.findall(regex, test_str, re.MULTILINE)
Simple is better:
regex = r"([^\ ]+)\t([^\ ]+)\t([^\ ]+)\t([^\ ]+)\t(.*)$" matches = re.findall(regex, line)
We must not use things like
https://github.com/helloSystem/Utilities/blob/265fe66c156d1debfeb5c8444b646db99fee053e/Developer%20Preview/Network.app/Network#L143-L148
where we hardcode the number of characters.
We need to use a regex instead.
This regex can parse the output correctly: