首页 > 解决方案 > 如何将坐标从文本文件导入 Python 程序并使用 Pyautogui 单击这些坐标

问题描述

嘿,我想知道我在标题中描述的内容是否可行?我现在拥有的代码,但这给了我错误是这样的:

首先我有我的文本文件,其中存储了一些坐标

516, 440
971, 443
1186, 439
1402, 441
1630, 449
299, 681
518, 684

这是我的 Python 代码:

import pyautogui
f = open("chrome_profiles.txt", "r")
line = f.read().splitlines()
cords= line[0]
pyautogui.click(cords)

标签: pythontextcoordinatespyautogui

解决方案


推荐阅读