【发布时间】:2015-10-25 13:37:23
【问题描述】:
我想创建一个动态大小的共享数组。我想在另一个进程中为其分配一个大小未知的数组。
from multiprocessing import Process, Value, Array
def f(a):
b=[3,5,7]
#resize(a,len(b)) # How to resize "a" ???
a[:]=b # Only works when "a" is initialized with the same size like the "b"
arr = Array('d', 0) #Array with a size of 0
p = Process(target=f, args=(arr))
p.start()
p.join()
print arr[:]
【问题讨论】:
标签: python multiprocessing ctypes python-multiprocessing