'b' modifier opens the file specified in binary mode. "binary" files are any files where the format isn't made up of readable characters. Binary files can range from image files like JPEGs or GIFs, audio files like MP3s or binary document formats like Word or PDF. In Python, files are opened in text mode by default. To open files in binary mode, when specifying a mode, add 'b' to it.
f = open('my_file', 'rb') file_content = f.read() f.close()
Above code opens my_file in binary read mode and stores the file content in file_content variable.