参考链接: os.path.getsize(path)
代码实验展示:
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> import os
>>>
>>> myPath = r"C:\Users\chenxuqi\Desktop\干扰\对抗样本\165.bmp"
>>> os.path.getsize(myPath)
2458678
>>>
>>> result = os.path.getsize(myPath)
>>> type(result)
<class 'int'>
>>> result
2458678
>>> print(result)
2458678
>>>
>>>
文件属性: