read n bytes from a binary file

Chris Liechti cliechti at gmx.net
Fri Nov 15 17:07:03 EST 2002


Rajarshi Guha <rajarshi at presidency.com> wrote in 
news:pan.2002.11.15.17.31.32.977054.25911 at presidency.com:
> How can I read N bytes from  a file opened in binary mode.

simply f.read(N)

> Basically I'm
> trying to check that a PDF file is indeed a PDF file


on a unixish system? consider the "file" command

chris
-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list