Skip to content Skip to sidebar Skip to footer

File Size Difference -python

When I read file size using st_size , I am getting 11264 bytes k = os.stat(r'C:\Users\sakth\Desktop\ASRS.txt') print(k.st_size) But when I read the file in chunk and sum up their

Solution 1:

You're on Windows, and your file presumably contains 204 (11264-11060) carriage return-linefeed pairs, which when read in text mode are normalized to a single linefeed (\n) character. Use binary mode ('rb') to avoid this conversion.


Post a Comment for "File Size Difference -python"