bundles / numpy latest / numpy / lib / _datasource / open
function
numpy.lib._datasource:open
source: build-install/usr/lib/python3.14/site-packages/numpy/lib/_datasource.py :154
Signature
def open ( path , mode = r , destpath = . , encoding = None , newline = None ) Summary
Open path with mode and return the file object.
Extended Summary
If path is an URL, it will be downloaded, stored in the DataSource destpath directory and opened from there.
Parameters
path: str or pathlib.PathLocal file path or URL to open.
mode: str, optionalMode to open
path. Mode 'r' for reading, 'w' for writing, 'a' to append. Available modes depend on the type of object specified by path. Default is 'r'.destpath: str, optionalPath to the directory where the source file gets downloaded to for use. If
destpathis None, a temporary directory will be created. The default path is the current directory.encoding: {None, str}, optionalOpen text file with given encoding. The default encoding will be what
openuses.newline: {None, str}, optionalNewline to use when reading text file.
Returns
out: file objectThe opened file.
Notes
This is a convenience function that instantiates a DataSource and returns the file object from DataSource.open(path).
Aliases
-
numpy.lib._datasource.open