git - python怎么实现文件跟踪?
迷茫
迷茫 2017-04-17 13:02:32
0
2
400
迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(2)
小葫芦

To monitor file changes, you can use the cross-platform watchdog module, but it may not support Python 3.

The pyinotify module can be used on Linux platform.

A simple way is to check the mtime (last modification time) of the file every few seconds (Tornado uses this method), but it is more resource-intensive.

PS: These are different from git. git has its own database, which stores the previous version of the file. When you git status it will compare the file in the current workspace with the version it has saved.

PPS: So your needs haven’t been made clear yet.

伊谢尔伦

You can refer to the debug mode of django or flask, which will automatically detect file changes and then restart the development server. However, I have not studied their implementation in detail. You can take a look at their source code

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!