Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
每次用新数据写入文件(被修改)并且我正在使用 Python 时,我想执行一个函数。
我该怎么做?
如果您想使用 Python 监视文件系统中的更改,请参阅本文以获取可以帮助您在不同平台上实现此目的的库的指针。
不同平台可用库的简短摘要:
请记住,您的程序需要运行才能处理文件系统事件。
我假设修改文件的不一定是您的 Python 程序。我不知道是否有独立于操作系统的方法。在 Linux 上,您可以使用pyinotify。