2023-04-01から1ヶ月間の記事一覧
import fcntl from datetime import datetime def main(): with open(__file__, "+a") as Lockfile: try: fcntl.flock(Lockfile.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB) while True: now = datetime.now().strftime("%Y-%m-%d %H:%M:%S") print(f"{now}: …