Created
April 8, 2013 01:17
-
-
Save clsung/5333476 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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