python_basic_09(零基础---socket基本使用)

适合零基础学习的—关于多任务-进程的简单练习:

import multiprocessing
import time

def test1():
    while True:
        print("--in test1--")
        time.sleep(1)

def test2():
    while True:
        print("--in test2--")
        time.sleep(1)

def main():
    p = multiprocessing.Process(target=test1)
    p.start()

    p2 = multiprocessing.Process(target=test2)
    p2.start()


if __name__ == '__main__':
    main()

猜你喜欢

转载自blog.csdn.net/weixin_44786482/article/details/89838529
今日推荐