📅  最后修改于: 2022-03-11 14:46:01.305000             🧑  作者: Mango
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