我尝试使用PyAutoGui创建一个函数来检查屏幕上是否显示图像,并提出了这个:
def check_image_on_screen(image):
try:
pyautogui.locateCenterOnScreen(image)
return True
except:
return False
Run Code Online (Sandbox Code Playgroud)
它工作正常,但PyCharm告诉我,我不应该except裸露.把它留下来有什么问题?有没有更合适的方法来创建相同的功能?
如何检查 python3 模块是否连接到互联网?
我看到这是Python2 的解决方案,并想做类似的事情。