I wrote a script for finding the characters and the file size
The value returned by os.path.getsize () is bytes only
When I tried to read the charecters it is giving less than the value given by the function.
output:
size-----679
charecters------662
why is this difference b/w the charecters and the size
The value returned by os.path.getsize () is bytes only
When I tried to read the charecters it is giving less than the value given by the function.
Code:
import os
File=open("C:\\df.txt",'r')
File.seek(0)
size=os.path.getsize("C:\\df.txt")
print "size-----"+str(size)
count=0
for c in File.read():
count=count+1
print "characters------"+str(count)
size-----679
charecters------662
why is this difference b/w the charecters and the size
Comment