read() does not read whole file in activepython/DOS
ishoej at gmail.com
Fri Nov 7 15:35:14 CET 2008
On Nov 7, 2:40 pm, Holger <ish... at gmail.com> wrote:
> This is what it looks like in DOS:
> ActivePython 188.8.131.52 (ActiveState Software Inc.) based on
> Python 2.5.2 (r252:60911, Mar 27 2008, 17:57:18) [MSC v.1310 32 bit
> (Intel)] on
> Type "help", "copyright", "credits" or "license" for more information.>>> b = open('boot.bin').read()
> >>> len(b)
> >>> import os
> >>> os.path.getsize('boot.bin')
> What is wrong? / What am I doing wrong?
> I would expect it to read the whole file.
Solution: open(<file>, 'rb')
More information about the Python-list