两个字进程 - 图1

    1. import multiprocessing
    2. import time
    3. def dance():
    4. for item in range(1, 5):
    5. print("跳舞...")
    6. time.sleep(0.2)
    7. pass
    8. pass
    9. def sing():
    10. for item in range(1, 5):
    11. print("唱歌...")
    12. time.sleep(0.2)
    13. pass
    14. pass
    15. if __name__ == "__main__":
    16. dance_process = multiprocessing.Process(target=dance)
    17. sing_process = multiprocessing.Process(target=sing)
    18. dance_process.start()
    19. sing_process.start()