determining bytes read from a file.
Diez B. Roggisch
deets at nospam.web.de
Thu Dec 13 07:13:54 EST 2007
vineeth wrote:
> Hello all,
> I have come across a weird problem, I need to determine the amount
> of bytes read from a file, but couldn't figure it out ,
> My program does this :
> __
> file = open("somefile")
> data = file.read()
> print "bytes read ", len(data)
> ---
>
> But the bytes read is not being printed correctly, I think bytes are
> being counted only till the first occurance of '\0' is encountered.
> Even though the file is of a very large size, the bytes till the first
> '\0' are counted.
I doubt that. Python doesn't interpret data when reading, and byte-strings
don't have a implicit 0-based length.
So I think you must be doing something different - clearly the above is not
actual code, but something made up for this post. Show us your actual code,
please.
diez
More information about the Python-list
mailing list