On Fri, 03 Mar 2006 16:57:10 +0000, John Salerno wrote: > Steven D'Aprano wrote: > >> The important term there is BINARY, not large. Many problems *reading* >> (not opening) binary files will go away if you use 'rb', regardless of >> whether they are small, medium or large. > > Is 'b' the proper parameter to use when you want to read/write a binary > file? I was wondering about this, because the book I'm reading doesn't > talk about dealing with binary files.
The interactive interpreter is your friend. Call help(file), and you will get: class file(object) | file(name[, mode[, buffering]]) -> file object | | Open a file. The mode can be 'r', 'w' or 'a' for reading (default), | writing or appending. The file will be created if it doesn't exist | when opened for writing or appending; it will be truncated when | opened for writing. Add a 'b' to the mode for binary files. plus extra information. Take note that the mode is NOT "b". It is "rb". -- Steven. -- http://mail.python.org/mailman/listinfo/python-list