Saturday, March 21, 2009

All modes in python built-in open function(转发)

The constructor for the built-in open() function is:

open(file,mode="r",buffering=None,encoding=None,errors=None,newline=None,closefd=True)

The possible modes are:

* r: Reading
* w: Open for writing
* a: Open for appending
* b: Binary mode
* t: Text mode
* +: Open a disk file for updating
* U: Universal newline mode

The default mode is rt, or open for reading text mode.

(原文地址:http://www.ibm.com/developerworks/linux/library/l-python3-1/
python 3.0 也有介绍 http://docs.python.org/3.0/library/io.html

No comments:

Post a Comment