summaryrefslogtreecommitdiff
path: root/numpy/lib/npyio.py
diff options
context:
space:
mode:
authorDaniel <dabi@blazemail.com>2013-06-04 07:20:09 +0200
committerCharles Harris <charlesr.harris@gmail.com>2013-08-15 18:13:16 -0600
commitb82c1df6f99c62a120dfd9d5c606110d593d96e7 (patch)
tree90cd2def2a87665dcf074187e09e1d4efe29ec57 /numpy/lib/npyio.py
parent37b6baa7c73b9f395b6e4d9f89194d96a79f0090 (diff)
downloadnumpy-b82c1df6f99c62a120dfd9d5c606110d593d96e7.tar.gz
ENH: Make savetxt work with file like objects.
Accept any object with a "write" method as that is the only method called by the code.
Diffstat (limited to 'numpy/lib/npyio.py')
-rw-r--r--numpy/lib/npyio.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py
index 7d561a393..6873a4785 100644
--- a/numpy/lib/npyio.py
+++ b/numpy/lib/npyio.py
@@ -1002,7 +1002,7 @@ def savetxt(fname, X, fmt='%.18e', delimiter=' ', newline='\n', header='',
fh = open(fname, 'wb')
else:
fh = open(fname, 'w')
- elif hasattr(fname, 'seek'):
+ elif hasattr(fname, 'write'):
fh = fname
else:
raise ValueError('fname must be a string or file handle')