【发布时间】:2022-01-08 00:48:09
【问题描述】:
我正在为 Discord 制作一个非常简单的垃圾邮件机器人,只是为了恶作剧我的朋友。但是 while True: 命令非常慢。有更快的替代方案吗?
import PIL
import pyautogui, time
time.sleep(5)
pyautogui.FAILSAFE = True
while True:
pyautogui.hotkey("command", "v")
pyautogui.press("enter")
if (pyautogui.locateOnScreen("av.png")):
(pyautogui.click(pyautogui.locateCenterOnScreen("av.png")))
【问题讨论】:
-
如果
while true真的太慢了,你真的不能用 Python 来做这件事。不过,问题可能在于您在循环中运行的任何内容的速度。