我得装很多
.csv
定期将文件导入Excel,如图所示
here (till step 9)
-
擅长
->
数据
->
来自文本
->
“通过导航到文件的位置,然后单击“导入”来选择文件。”
文本导入向导第1步,共3步
这些都是我通过编写一个小python脚本自动完成的步骤,在这个脚本中,我让python按快捷键(想象一下在没有鼠标的情况下工作,并通过按快捷键在Excel中导航)。
import pyautogui
from pywinauto.application import Application
app = Application().start('C:\Program Files (x86)\Microsoft Office\Office12\EXCEL.exe')
pyautogui.press('alt')
pyautogui.press('a')
pyautogui.press('f')
pyautogui.press('t')
pyautogui.typewrite(r'C:\Users\Jo\Revenue.txt')
pyautogui.press('enter')
在运行了上述python脚本之后,我看到了以下内容
导入向导
窗口-
现在,我如何让python做出选择
65001 : Unicode (UTF-8)
从下拉列表中?如何在python代码中指定选择这种编码?如有任何意见,我们将不胜感激。