Skip to content

Instantly share code, notes, and snippets.

@clsung
Created April 8, 2013 01:17
Show Gist options
  • Save clsung/5333476 to your computer and use it in GitHub Desktop.
Save clsung/5333476 to your computer and use it in GitHub Desktop.
import mmap
from time import sleep
with open('cmd.txt', 'r+b') as f:
m = mmap.mmap(f.fileno(), 0)
while True:
data = m.readline()
print data
sleep(0.5)
m.seek(0)
import mmap
from time import sleep
with open('cmd.txt', 'r+b') as f:
m = mmap.mmap(f.fileno(), 0)
m.seek(0)
m.write("hihihi\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment