file processing question

Jere Kahanpaa kahanpaa at
Mon Sep 2 07:05:33 EDT 2002


Axel Grune <NineOfSix at> wrote:
> Hi, Im trying to read the data of a file with following method

> file = open( inputfile, "r")
> data =
> file.close()

> but 'data' is always smaller then the file size, e.g. I have a file 
> which is 25677824 bytes but reads only 4295 (file.tell() = 
> 25677824).
> Im using python 2.2 under win2k.

Is your data binary or plaintext? Have you tried reading in binary mode? 

file = open(inputfilename,"rb")
data =

It's hard to think outside the box when you ARE the box.
                            - unknown, alt.religion.kibology 

More information about the Python-list mailing list