+ 2

Search for a word (up or down) that occurs after ifAdminStatus.

After I ran my python script I’m trying to search for a specific string in the data that looks like (‘ifAdminStatus’: ‘up’) or (‘ifAdminStatus’: ‘down’). Print out the up and down part in a file but I’m having a hard time searching for it since this occurs 100 times in the script.

24th Jan 2019, 6:20 PM
Shyam
Shyam - avatar
2 odpowiedzi
+ 4
Regular expression can do a trick. Read line by line, evaluate against re and then append value to list.
24th Jan 2019, 6:26 PM
Hubert Dudek
Hubert Dudek - avatar
0
yes i have tried that but I’m confused on how to do it because the data is so in a file and its just the data from the script I ran
25th Jan 2019, 2:52 PM
Shyam
Shyam - avatar