summaryrefslogtreecommitdiff
path: root/numpy/add_newdocs.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2006-09-05 00:54:09 +0000
committerCharles Harris <charlesr.harris@gmail.com>2006-09-05 00:54:09 +0000
commit2e6688521aabe7a03fd980e226f7088abb71a307 (patch)
tree18013b9ad0dcf5b852db122e91486841cdbfa9fa /numpy/add_newdocs.py
parent9ae4fd02510b4aef8423896edca66ffd5412f3a8 (diff)
downloadnumpy-2e6688521aabe7a03fd980e226f7088abb71a307.tar.gz
Document the method tofile()
Diffstat (limited to 'numpy/add_newdocs.py')
-rw-r--r--numpy/add_newdocs.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py
index 421e01daf..e4aed4c83 100644
--- a/numpy/add_newdocs.py
+++ b/numpy/add_newdocs.py
@@ -1035,7 +1035,25 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('take',
add_newdoc('numpy.core.multiarray', 'ndarray', ('tofile',
- """a.tofile(fid, sep="") -> None. Write the data to a file.
+ """a.tofile(fid, sep="", format="%s") -> None. Write the data to a file.
+
+ Required arguments:
+ file -- an open file object or a filename
+
+ Keyword arguments:
+ sep -- separator for text output. Write binary if empty (default "")
+ format -- format string for text file output (default "%s")
+
+ A convenience function for quick storage of array data. Information on
+ endianess and precision is lost, so this method is not a good choice for
+ files intended to archive data or transport data between machines with
+ different endianess. Some of these problems can be overcome by outputting
+ text files at the expense of speed and file size.
+
+ If 'sep' is empty this method is equivalent to file.write(a.tostring()). If
+ 'sep' is not empty each data item is converted to the nearest Python type
+ and formatted using "format"%item. The resulting strings are written to the
+ file separated by the contents of 'sep'.
"""))