random \ in data might be dropped on inputor added for \ in the data on output the net effect is that your binary data would be trashed when read and written-probably not quite what you want for your audio files and imagesthis issue has become almost secondary in python xbecause we generally cannot use binary data with text-mode files anyhow--because text-mode files automatically apply unicode encodings to contenttransfers will generally fail when the data cannot be decoded on input or encoded on output using binary mode avoids unicode errorsand automatically disables line-end translations as well (unicode error can be caught in try statements as wellstillthe fact that binary mode prevents end-of-line translations to protect file content is best noted as separate featureespecially if you work in an ascii-only world where unicode encoding issues are irrelevant here' the end-of-line translation at work in python on windows--text mode translates to and from the platform-specific line-end sequence so our scripts are portableopen('temp txt'' 'write('shrubbery\ ' open('temp txt''rb'read( 'shrubbery\ \nopen('temp txt'' 'read('shrubbery\ntext output mode\ -\ \ binary inputactual file bytes test input mode\ \ -\ by contrastwriting data in binary mode prevents all translations as expectedeven if the data happens to contain bytes that are part of line-ends in text mode (byte strings print their characters as ascii if printableelse as hexadecimal escapes)data ' \ \rc\ \ndlen(data open('temp bin''wb'write(data open('temp bin''rb'read( ' \ \rc\ \nd escape code bytes normal write binary data to file as is read as binaryno translation but reading binary data in text modewhether accidental or notcan corrupt the data when transferred because of line-end translations (assuming it passes as decodable at allascii bytes like these do on this windows platform)open('temp bin'' 'read(' \ \nc\ndtext mode readbotches \ similarlywriting binary data in text mode can have as the same effect--line-end bytes may be changed or inserted (againassuming the data is encodable per the platform' default)open('temp bin'' 'write(datatypeerrormust be strnot bytes data decode(' \ \rc\ \nd file and directory tools must pass str for text mode use bytes decode(for to-str