title: Getting file size in Python?
body: <p>Is there a built-in function for getting the size of a file object in bytes? I see some people do something like this:</p>
  
  <pre><code>def getSize(fileobject):
      fileobject.seek(0,2) # move the cursor to the end of the file
      size = fileobject.tell()
      return size
  
  file = open('myfile.bin', 'rb')
  print getSize(file)
  </code></pre>
  
  <p>But from my experience with Python, it has a lot of helper functions so I'm guessing maybe there is one built-in.</p>