python - 如何从字母数字中获取数字输出(Pyautogui)
问题描述
你怎么能只得到数字输出
pyautogui.locateOnScreen('Capture.png')
如果pyautogui
在屏幕上找不到图片,您将获得输出;无,或者如果pyautogui
在屏幕上找到图片,它将给出如下输出;框(左=1416,上=562,宽=50,高=41)
是否可以仅从输出中获取数字?
解决方案
参考文档,pyautogui
可以使用:
location = pyautogui.locateOnScreen('Capture.png')
if location != None:
x, y, w, h = location
或者:
if location != None:
x, y, w, h = location.left, location.top, location.width, location.height
推荐阅读
- sass - 无法使用 svelte-image 处理 scss
- php - 使用非唯一元键获取特定的 WooCommerce 订单项元数据
- python - 使用 numpy 组合两个 n 维数组
- pimcore - 如何在 Pimcore 上以不同的语言 csv 导出我的目录?
- elasticsearch - 使用 webhook 自动化 SIEM 响应
- python - 为什么我的程序在我想显示后没有响应?
- php - 如何修复 vagrant 自动使用的 homestead.rb 路径?
- string - 在第二个分隔符 VB NET 之后获取字符串
- c# - C# - Linux 上的 SMTP 邮件发送不起作用
- r - 在 macos 11 Big Sur 上安装 Rserve