在两个Python程序之间共享一个后进先出结构

2024-04-19 11:23:27 发布

您现在位置:Python中文网/ 问答频道 /正文

Possible Duplicate:
Clean way to get near-LIFO behavior from multiprocessing.Queue? (or even just *not* near-FIFO)

我想分享后进先出(Queue.LifoQueue())两个不同Python程序之间的结构。在

一个充当作者,另一个充当读者

现在它只是一个简单的应用程序来共享读/写时间。在

读取器应在后进先出中插入UNIX时间戳,然后读取器读取:

**#writer.py**
def getWriteTime():
   os.system("date +%s")
   # write to the LIFO structure



**#reader.py**
def getReadTime():
   # read from the LIFO structure
   # do calculations

问题是,如何在两个python程序之间共享相同的数据结构而不将其写入磁盘?在

我知道多处理库允许在进程之间共享资源,但我不太了解如何在python程序之间共享LIFO(队列)

提前谢谢你


Tags: thetofrompy程序cleanqueuedef