title: After writing to a file, why does os.path.getsize still return the previous size?
body: <p>I am trying to split up a large xml file into smaller chunks. I write to the output file and then check its size to see if its passed a threshold, but I dont think the getsize() method is working as expected.</p>
  
  <p>What would be a good way to get the filesize of a file that is changing in size.</p>
  
  <p>Ive done something like this...</p>
  
  <pre><code>import string
  import os
  
  f1 = open('VSERVICE.xml', 'r')
  f2 = open('split.xml', 'w')
  
  for line in f1:
    if str(line) == '&lt;/Service&gt;\n':
      break
    else:
      f2.write(line)
      size = os.path.getsize('split.xml')
      print('size = ' + str(size))
  </code></pre>
  
  <p>running this prints 0 as the filesize for about 80 iterations and then 4176. Does Python store the output in a buffer before actually outputting it?</p>