-
工具描述
在進行一項時間非常長的測試時,需要對程序、任務管理器狀態等進行監控,由此需要一個定時截屏的功能
-
代碼
from PIL import ImageGrab
import time
count = 0
while True:
count += 1
pic = ImageGrab.grab()
name = time.strftime("%Y-%m-%d---%H:%M:%S", time.localtime()).replace(':', '-')
pic.save(r'E:\img\%s.jpg' % name)
print(count)
time.sleep(60)
注意,需要安裝pillow庫