Search for a word (up or down) that occurs after ifAdminStatus. | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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 Respostas
+ 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