file processing question

Jere Kahanpaa kahanpaa at gstar.astro.helsinki.fi
Mon Sep 2 13:05:33 CEST 2002


Hi.


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

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

> but 'data' is always smaller then the file size, e.g. I have a file 
> which is 25677824 bytes but file.read() 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 = file.read()
file.close()


Jere
-- 
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