<p>是否有一个内置函数来获取文件对象的字节大小?我看到一些人这样做:</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>但是根据我对Python的经验,它有很多帮助函数,所以我猜可能有一个内置的。</p>