os.path.size() 中的大小面额是多少?- Python

alv*_*vas 2 python size operating-system file path

os.path.getsize()可用于获取文件的大小。

但这个数字代表什么:

  • 字节?
  • 位?
  • 兆字节?

另外,我确信涉及一些舍入,因为它总是返回一个整数,它是向上舍入还是向下舍入?

Ofi*_*ael 7

这是您要找的吗?(从这里

"""
os.path.getsize(path)
Return the size, in bytes, of path. Raise os.error if the file does not exist or is inaccessible.
"""
Run Code Online (Sandbox Code Playgroud)