from sys import getsizeof
ls = [0] * 300000000
size = getsizeof(ls)
print(size)
print(size, "Byte")
print(size / 1024, "KB")
print(size / 1024 / 1024, "MB")
print(size / 1024 / 1024 / 1024, "GB")
print(size / 1024 / 1024 / 1024 / 1024, "TB")
'''
1200000036 Byte
1171875.03515625 KB
1144.4092140197754 MB
1.117587123066187 GB
'''
path = r"D:\天翼云盘下载\VMware-workstation-full-16.0.0-16894299.exe.ecdl"
s = os.path.getsize(path) # 获取文件大小 Byte
print(s, "Byte")
print(s / 1024, "KB")
print(s / 1024 / 1024, "MB")
print(s / 1024 / 1024 / 1024, "GB")
print(s / 1024 / 1024 / 1024 / 1024, "TB")
'''
440614386 Byte
430287.486328125 KB
420.20262336730957 MB
0.41035412438213825 GB
'''
'''
1Byte = 8 Bit
1KB = 1024 B(Bytes)
1MB = 1024 KB
1GB = 1024 MB
1TB = 1024 GB
'''
12-05
1195
10-01
2669