1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Python Multiprocessing empty array

Discussão em 'Python' iniciado por Stack, Julho 17, 2025.

  1. Stack

    Stack Membro Participativo

    I am just trying multiprocessing in Python and I got a problem.

    from multiprocessing import Process

    w = 4;
    arr = []

    def func(num):
    for i in range(num,50,w):
    arr.append(i)

    if __name__ == '__main__':
    p1 = Process(target=func, args=(1,))
    p1.start()
    p2 = Process(target=func, args=(2,))
    p2.start()
    p1.join()
    p2.join()


    After running the code I get empty values for 'arr' array.

    Continue reading...

Compartilhe esta Página