summaryrefslogtreecommitdiff
path: root/numpy/lib/npyio.py
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2019-04-26 09:21:32 -0700
committerSebastian Berg <sebastian@sipsolutions.net>2019-04-26 09:35:05 -0700
commit59a521ee07693cc5c58d68987691df4bcc9e48ff (patch)
tree6ba8883728a85a9615a862dd510c7e730d895d07 /numpy/lib/npyio.py
parentdea1239b6dcaf072fc9b70e6af0c0a100cead69e (diff)
downloadnumpy-59a521ee07693cc5c58d68987691df4bcc9e48ff.tar.gz
BUG: (py2 only) fix unicode support for savetxt fmt string
By now, all that is needed is to also allow unicode strings to pass through. Adds a test for the support which already succeeds on python3. Closes gh-4053 (replaces the old PR)
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 beeba1334..3414ecd81 100644
--- a/numpy/lib/npyio.py
+++ b/numpy/lib/npyio.py
@@ -1390,7 +1390,7 @@ def savetxt(fname, X, fmt='%.18e', delimiter=' ', newline='\n', header='',
if len(fmt) != ncol:
raise AttributeError('fmt has wrong shape. %s' % str(fmt))
format = asstr(delimiter).join(map(asstr, fmt))
- elif isinstance(fmt, str):
+ elif isinstance(fmt, basestring):
n_fmt_chars = fmt.count('%')
error = ValueError('fmt has wrong number of %% formats: %s' % fmt)
if n_fmt_chars == 1: