Python·100 questionsHow to correctly work with files in binary mode?SaveUpdated: 2026-08-31Answer•open(path, 'rb') for reading bytes.•For writing: 'wb'.•Do not specify encoding in binary mode.•For large files — use chunks.•For hashes — hashlib.Ask AI to clarifyWas this answer helpful?HelpfulNot helpfulSuggest an improvement