我有一个简单的计数器循环,在使用'print'
时工作正常import time
def screenshot(get_name):
print('Screenshoting {0}').format(get_name)
time.sleep(1)
counter = 0
while True:
screenshot(counter)
counter = counter + 1
但是当我尝试将它应用到os.system(“Command”)时它不起作用?
import time
def screenshot(get_name):
os.system("screencapture ~/Desktop/test/screenshot{0}.jpg").format(get_name)
time.sleep(1)
counter = 0
while True:
screenshot(counter)
counter = counter + 1