I have a text file which contains below lines.
Existing Power Schemes (* Active)
-----------------------------------
Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e (Balanced)
Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (High performance)
Power Scheme GUID: a1841308-3541-4fab-bc81-f71556f20b4a (Power saver)
Here i need to find only GUID values.
Ex:381b4222-f694-41f0-9685-ff5bb260df2e
8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
a1841308-3541-4fab-bc81-f71556f20b4a
How to do this?
I am beginner to python.
What I have tried:
I tried below thing
testfile = os.path.join(os.getcwd(), "power_all.txt")
with open(testfile, "r+") as pwr:
for line in pwr:
scheme_guid = line.split("GUID:")[-1]
print(scheme_guid)
I getting output as below:
Existing Power Schemes (* Active)
-----------------------------------
381b4222-f694-41f0-9685-ff5bb260df2e (Balanced)
8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (High performance)
a1841308-3541-4fab-bc81-f71556f20b4a (Power saver) *