📜  使用文件的 python 锁定 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:01.305000             🧑  作者: Mango

代码示例1
from filelock import FileLock

with FileLock("myfile.txt.lock"):
    print("Lock acquired.")
    with open("myfile.txt"):
        # work with the file as it is now locked