您的位置:首页 > 编程语言 > Python开发

python 的一些常用功能

2015-03-19 09:56 302 查看
1 pyhon3的对文件系统的变化监控功能

import time

def handle(*args):
print(args[0],args[1])
#    fsw = FileSystemWatcher("c:/aaa/output")
#dir = "c:/aaa/output"

import watcher
dir = "C:/aaa/output"
dir = "N:/data"
w = watcher.Watcher(dir, handle)
#w.flags = watcher.FILE_NOTIFY_CHANGE_FILE_NAME
w.flags = watcher.FILE_NOTIFY_CHANGE_CREATION | watcher.FILE_NOTIFY_CHANGE_FILE_NAME
w.recursive=True
print("program start...")
w.start()
time.sleep(60*60*60)
print("program exit...")
注意:1 用cxfreeze watcher.py --target-dir dist 生成exe时候,dist目录中的watcher._watcher.pyd要随产品一起发布
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: