summaryrefslogtreecommitdiff
path: root/numpy/lib/npyio.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/npyio.py')
-rw-r--r--numpy/lib/npyio.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py
index 390927601..d8cfbf769 100644
--- a/numpy/lib/npyio.py
+++ b/numpy/lib/npyio.py
@@ -412,12 +412,13 @@ def load(file, mmap_mode=None, allow_pickle=True, fix_imports=True,
try:
# Code to distinguish from NumPy binary files and pickles.
_ZIP_PREFIX = b'PK\x03\x04'
+ _ZIP_SUFFIX = b'PK\x05\x06' # empty zip files start with this
N = len(format.MAGIC_PREFIX)
magic = fid.read(N)
# If the file size is less than N, we need to make sure not
# to seek past the beginning of the file
fid.seek(-min(N, len(magic)), 1) # back-up
- if magic.startswith(_ZIP_PREFIX):
+ if magic.startswith(_ZIP_PREFIX) or magic.startswith(_ZIP_SUFFIX):
# zip-file (assume .npz)
# Transfer file ownership to NpzFile
tmp = own_fid
@@ -1259,8 +1260,8 @@ def savetxt(fname, X, fmt='%.18e', delimiter=' ', newline='\n', header='',
References
----------
.. [1] `Format Specification Mini-Language
- <http://docs.python.org/library/string.html#
- format-specification-mini-language>`_, Python Documentation.
+ <https://docs.python.org/library/string.html#format-specification-mini-language>`_,
+ Python Documentation.
Examples
--------
@@ -1624,7 +1625,7 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None,
References
----------
.. [1] NumPy User Guide, section `I/O with NumPy
- <http://docs.scipy.org/doc/numpy/user/basics.io.genfromtxt.html>`_.
+ <https://docs.scipy.org/doc/numpy/user/basics.io.genfromtxt.html>`_.
Examples
---------