mutex = threading.Lock() def write_to_file(file_name,text): mutex.acquire() a = open(file_name,‘a‘) a.write(text+"\n") a.close() mutex.release()
write_to_file
原文:https://www.cnblogs.com/yakoazz/p/10803526.html