import threading def do(event,i): print("{}憋的不行了,等着上厕所".format(i)) event.wait() print("{}赶紧进去撒了泡尿出来了".format(i)) event_obj = threading.Event() mylist = ['厉智','徐晓冬','陈培昌','程劲'] for i in mylist: t = threading.Thread(target=do,args=(event_obj,i)) t.start() event_obj.clear() data = input('老张带队太辛苦,坐在马桶上睡着了 -f 叫醒老张 -k 让老张继续睡') if data == 'f': print('老张被叫醒了,提裤子走了出来') event_obj.set()