We are given a 2-dimensional grid. "." is an empty cell, "#" is a wall, "@" is the starting point, ("a", "b", ...) are keys, and ("A", "B", ...) are locks. We start at the starting poin
1.创建进程 守护进程(*****) _.daemon = True # _进程成为守护进程 守护进程也是一个子进程. 主进程的<代码>执行结束之后守护进程自动结束. import time from multiprocessing import Process def func(): while True: print('is alive') time.sleep(0.5) def wahaha(): i = 0 while i < 5: print(f'第{i}秒') i += 1
一.多进程应用 import socket from multiprocessing import Process def talk(conn): conn.send(b'connected') ret = conn.recv(1024) print(ret) if __name__ == '__main__': sk = socket.socket() sk.bind(('127.0.0.1', 8080)) sk.listen() while True: conn,addr = sk.acc