I use the following code to write data to a file:
fr = open('filename', 'w')
for x in lines: #lines is a list with about 10k numbers
f.write(str(x) + ' ')
The data of last lines or the last line get lost sometimes, but I changed the buffersize to 0, which means modifying code to fr = open ('filename', 'w', 0)
, no data lose. Why should I use this parameter? What the use of buffersize parameter? Any other way to prevent the loss?