Files
open(filename [, mode])
- Opens a file and returns a file object.
- Mode is one of the following
"r" - Open for reading (the default)
"w" - Open for writing (destroys old contents if any)
"a" - Open for append
"r+" - Open for read/write (updates)
"w+" - Open for read/write (destroys old contents first).
- An optional "b" may be appended to specify binary data.
- Example:
f = open("foo") # Open for reading
g = open("bar","w") # Open for writing
h = open("spam","rb") # Open for reading (binary)
|