i am a beginner in Python. I have a query.
I have a .txt file which has entries in the following manner:
Name: John
Age: 21
Name: Paul
Age:23
I need to search for the string "Name" and display all the values corresponding to the string that i am searching for. In this case the result should be John and Paul.
I am a bit confused with the re.search() function.
Kindly guide me regarding the same.
Regards,
BK
I have a .txt file which has entries in the following manner:
Name: John
Age: 21
Name: Paul
Age:23
I need to search for the string "Name" and display all the values corresponding to the string that i am searching for. In this case the result should be John and Paul.
I am a bit confused with the re.search() function.
Kindly guide me regarding the same.
Regards,
BK
Comment