Hi, the following is the code.
import time
from multiprocessing import Process
class Worker(Process):def run(self): print(f'In {self.name}') time.sleep(2)
def main():
worker = Worker() worker.start() worker2 = Worker() worker2.start() worker.join() worker2.join()
if name == ‘main’:
main()
with the following output:
In Worker-1
In Worker-2
[Finished in 2.109s]
I was confused. My question is, where do the names “Workr-1” and “Worker-2” come from? Many thanks.