open() returns a file object, and is most commonly used with two arguments: `open(filename, mode)'.
>>> f=open('/tmp/workfile', 'w') >>> print f <open file '/tmp/workfile', mode 'w' at 80a0960>
On Windows, (XXX does the Mac need this too?) 'b' appended to the mode opens the file in binary mode, so there are also modes like 'rb', 'wb', and 'r+b'. Windows makes a distinction between text and binary files; the end-of-line characters in text files are automatically altered slightly when data is read or written. This behind-the-scenes modification to file data is fine for ASCII text files, but it'll corrupt binary data like that in JPEGs or `.EXE' files. Be very careful to use binary mode when reading and writing such files.