summaryrefslogtreecommitdiff
path: root/numpy/lib/io.py
diff options
context:
space:
mode:
authorPaul Ivanov <paul.ivanov@local>2009-12-28 20:49:52 +0000
committerPaul Ivanov <paul.ivanov@local>2009-12-28 20:49:52 +0000
commite4f233ecfedd2aafa258db2d3ae27e30604cc020 (patch)
tree6d32fbdd19b8dca00cd7cafd8df076bac55ddfd8 /numpy/lib/io.py
parent5ba01996a9ab2fdfb7c120a5afae801f854a781a (diff)
downloadnumpy-e4f233ecfedd2aafa258db2d3ae27e30604cc020.tar.gz
fixed a whole bunch of doctests
Diffstat (limited to 'numpy/lib/io.py')
-rw-r--r--numpy/lib/io.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/numpy/lib/io.py b/numpy/lib/io.py
index 7d2ac1c0e..66d695b00 100644
--- a/numpy/lib/io.py
+++ b/numpy/lib/io.py
@@ -734,9 +734,10 @@ def savetxt(fname, X, fmt='%.18e', delimiter=' '):
Examples
--------
- >>> savetxt('test.out', x, delimiter=',') # X is an array
- >>> savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays
- >>> savetxt('test.out', x, fmt='%1.4e') # use exponential notation
+ >>> x = y = z = np.arange(0.0,5.0,1.0)
+ >>> np.savetxt('test.out', x, delimiter=',') # X is an array
+ >>> np.savetxt('test.out', (x,y,z)) # x,y,z equal sized 1D arrays
+ >>> np.savetxt('test.out', x, fmt='%1.4e') # use exponential notation
"""
@@ -833,7 +834,7 @@ def fromregex(file, regexp, dtype):
>>> regexp = r"(\\d+)\\s+(...)" # match [digits, whitespace, anything]
>>> output = np.fromregex('test.dat', regexp,
- [('num', np.int64), ('key', 'S3')])
+ ... [('num', np.int64), ('key', 'S3')])
>>> output
array([(1312L, 'foo'), (1534L, 'bar'), (444L, 'qux')],
dtype=[('num', '<i8'), ('key', '|S3')])
@@ -974,7 +975,7 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None,
>>> s = StringIO("1,1.3,abcde")
>>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'),
- ('mystring','S5')], delimiter=",")
+ ... ('mystring','S5')], delimiter=",")
>>> data
array((1, 1.3, 'abcde'),
dtype=[('myint', '<i8'), ('myfloat', '<f8'), ('mystring', '|S5')])
@@ -983,7 +984,7 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None,
>>> s.seek(0) # needed for StringIO example only
>>> data = np.genfromtxt(s, dtype=None,
- names = ['myint','myfloat','mystring'], delimiter=",")
+ ... names = ['myint','myfloat','mystring'], delimiter=",")
>>> data
array((1, 1.3, 'abcde'),
dtype=[('myint', '<i8'), ('myfloat', '<f8'), ('mystring', '|S5')])
@@ -992,7 +993,7 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None,
>>> s.seek(0)
>>> data = np.genfromtxt(s, dtype="i8,f8,S5",
- names=['myint','myfloat','mystring'], delimiter=",")
+ ... names=['myint','myfloat','mystring'], delimiter=",")
>>> data
array((1, 1.3, 'abcde'),
dtype=[('myint', '<i8'), ('myfloat', '<f8'), ('mystring', '|S5')])
@@ -1001,7 +1002,7 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None,
>>> s = StringIO("11.3abcde")
>>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'],
- delimiter=[1,3,5])
+ ... delimiter=[1,3,5])
>>> data
array((1, 1.3, 'abcde'),
dtype=[('intvar', '<i8'), ('fltvar', '<f8'), ('strvar', '|S5')])