2016-02-28 41 views
0

我想用python编写一个脚本,它需要一个in.txt文件,并获取每一行复制并粘贴到某个坐标,然后单击某个坐标。复制和粘贴自动化

是否有任何模块可以帮助我完成这项自动化任务?

这里是我的伪代码:

-get in file 

-put lines into array 

-for each line in the array 

{ 
    copy it 
    paste to a certain coordinate 
    click a certain coordinate 
} 
+0

贴在那里,点击某一坐标还不是很清楚。你究竟想用文件的内容来做什么? –

回答

0

如果要复制到剪贴板,并让脚本处理将剪贴板中的线的提取,你可以看看pyperclip模块。

但对于你的情况,你为什么不只是使用内置的功能,如

fileName = open(urlToFile) 
fileNameContentString = fileName.read() #return a string of entire content 
#or 
fileNameContentList = fileName.readlines() #return a list of string of each line 
#finally don't forget to close 
fileName.close() 

for line in fileNameContentList: 
    print line 
    # whatever else you would like to do with the line.