这是我的剧本。我想要做的是,如果调用函数有效,我想运行print函数。
from subprocess import call
from os import system as S
Com1 = 'sudo xrandr --newmode "1368x768_60.00" 85.25 1368 1440 1576
1784 768 771 781 798 -hsync +vsync'
Command1 = Com1.split()
Com2 = 'sudo xrandr --addmode VGA1 "1368x768_60.00"'
Command2 = Com2.split()
COMMAND1 = call(Command1)
COMMAND2 = call(Command2)
print('\n\n\t\nscreen resolution successfully changed Script By : My name '.title())
print('\n\n')
这是一个伪代码:
if COMMAND1 and COMMAND2 worked:
print('It WorkEd')
else:
print('IT DIDNT WORK')
有人可以帮助我。我是Python的新手。