Printing specific items from Python Shell

  Kiến thức lập trình

I have this code:

import subprocess
activescheme = subprocess.check_output('powercfg -getactivescheme')
print(str(activescheme, encoding='cp866'))

And this output:

GUID схемы питания: 22222222-2222-2222-2222-222222222222  (Высокая производительность)

I want to check this the output ad then print message in tkinter, but I coildn’t. So I think that I can take only words from brackets and print them in tk. I don’t know how to do this

I tried this but didn’t get a result, the output was No

import subprocess
activescheme = subprocess.check_output('powercfg -getactivescheme')
print(str(activescheme, encoding='cp866'))
if activescheme == "GUID схемы питания: 22222222-2222-2222-2222-222222222222  (Высокая производительность)":
    print("Yes")
else:
    print("No")

Help, please

New contributor

KAPTOLLIKA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT