I\'m running a test, and found that the file doesn\'t actually get written until I control-C to abort the program. Can anyone explain why that would happen?
You need to f.close() to flush the file write buffer out to the file. Or in your case you might just want to do a f.flush(); os.fsync(); so you can keep looping with the opened file handle.