how to do reading of binary files?

Roger Miller roger.miller at nova-sol.com
Fri Jun 8 21:52:12 CEST 2007


On Jun 8, 2:07 am, "Diez B. Roggisch" <d... at nospam.web.de> wrote:

>> ...
>
> What has the searching to do with the reading? 10MB easily fit into the
> main memory of a decent PC, so just do
>
> contents = open("file").read() # yes I know I should close the file...
>
> print contents.find('\x0c')
>
> Diez

Better make that 'open("file", "rb").




More information about the Python-list mailing list