Editing an open document with python

蓝咒 提交于 2019-12-13 07:43:40

问题


Is it possible to add or remove entries to an excel file or a text file while it is still open (viewing live update of values from python output) instead of seeing the output in terminal?


回答1:


It depends on the application you are using to view the file. You will have to check the features available in the tools you are using.

For instance, in Excel, this is impossible. When you open an Excel document, it actually creates an invisible copy. You are not editing the original. It is only when the file is saved that the original is updated. So, if you have a file my_excel_file.xlsx, when you open it, another file is created named ~$my_excel_file.xlsx. So, editing the original file will not update the file being viewed in the Excel application.

For text files, on the other hand, there are some applications that will reload changes from disk. Sublime Text is an example of this. If you have a file open in Sublime Text, then make a change to the file with another program, Sublime Text will automatically reload the new version when the application regains focus.



来源:https://stackoverflow.com/questions/28879391/editing-an-open-document-with-python

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!