I am trying to sort through an output of a command line, and I need to snip a certain name that can vary in length, and name. The output I am trying to split is
AP Name.......................................... AP-Test
The name AP-Test can be any length or name. I was trying to split it by, '.' but that would create a bunch of substrings. I currently store my output into a file called Result.txt, sort through looking for lines with AP Name, but I need to snag the end of the string stored in a list.
APnames = [] # AP name lists
APlinenum = 0 # AP line number index
APsubstr = "AP Name.".lower() # searching for "AP Name".
fileA = open("Results.txt", 'a+')
for line in fileA:
APlinenum += 1
if line.lower().find(APsubstr) != -1: # if case-insensitive match,
APnames.append(line.rstrip('\n'))
fileA.close()
APname = "the actual AP-name"
There is the issue of if the AP name contains a period, it would be split.
The expected output would be the string APname is the exact name and no other characters.