jinjia2 中文文档
with 上下文管理器

python的文件锁

erhuabushuo posted @ 2012年6月24日 19:27 in Python , 1811 阅读



"""
文件锁测试
"""

import fcntl
import time

fp = open('hello.txt','w')
fcntl.flock(fp, fcntl.LOCK_EX)
print '文件锁开始执行'
time.sleep(100)
fcntl.flock(fp, fcntl.LOCK_UN)
fp.close()

seo service london 说:
2024年2月26日 23:28

Thanks so much for the blog post.Really thank you! Much obliged


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter