摘要: python 中给文件加锁——fcntl模块import fcntl打开一个文件##当前目录下test文件要先存在,如果不存在会报错。或者以写的方式打开f = open('./test')对该文件加密:fcntl.flock(f,fcntl.LOCK_EX)这样就对文件test加锁了,如果有其他进程 阅读全文
posted @ 2018-07-09 14:16 GavinSimons 阅读(562) 评论(0) 推荐(0) 编辑