Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
os.path.getsize()可用于获取文件的大小。
os.path.getsize()
但是数字代表什么:
另外,我确定会涉及一些舍入,因为它总是返回一个整数,它是向上舍入还是向下舍入?
这是你要找的吗?(从这里)
""" os.path.getsize(path) Return the size, in bytes, of path. Raise os.error if the file does not exist or is inaccessible. """
它以字节为单位返回大小,如此处找到的官方 Python 文档中所示