2👍
✅
Open with binary mode.
open(the_file, 'rb')
http://docs.python.org/2/library/functions.html#open
The default is to use text mode, which may convert ‘\n’ characters to
a platform-specific representation on writing and back on reading.
Thus, when opening a binary file, you should append ‘b’ to the mode
value to open the file in binary mode, which will improve portability.
(Appending ‘b’ is useful even on systems that don’t treat binary and
text files differently, where it serves as documentation.)
Source:stackexchange.com