Advertisement
Guest User

Untitled

a guest
Jan 15th, 2021
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.21 KB | None | 0 0
  1. import time
  2. from filelock import Timeout, FileLock
  3.  
  4. lock = FileLock("./test.txt.lock")
  5.  
  6. with lock:
  7.     x = open("./test.txt", "w")
  8.     x.write("test\n")
  9.     x.flush()
  10.     while True:
  11.         time.sleep(1)
  12.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement