I am trying to use mmap to share data between two python scripts. I want to clear the buffer after each write. How to it?
for example:
import mmap
from time import sleep
while true:
a=mmap.mmap(0, 200, 'GlobalSharedMemory')
inp = bytes("Hello!","utf-8")
a.write(inp)
sleep(0.01)
#a[0:200] = []
# or:
#a.clear()
inp = bytes("How are you?,"utf-8")
a.write(inp)
Is there a clear method or something that can let me write again to the byte array from the beginning? I mean All rewrites should start from index 0. Thanks.