[Tutor] Different md5 values for files under Unix and Python?

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Mon Jan 19 02:19:32 EST 2004


> And make sure the file is being opened in 'binary mode':
>
>     a.update(open('filename').read('rb'))
>
> This is to ensure that the operating system doesn't try to misguidedly
> do newline/carriage return conversions.

... duh.  I'm sorry, I screwed that up completely.  My code above there is
totally bogus.


I mean to say:

    a.update(open('filename', 'rb').read())

The 'rb' was meant to be the second argument to the open() function call.
It certainly wasn't supposed to be fed into read()!  *grin*


My apologies again; I'll try to be more careful next time.




More information about the Tutor mailing list