numpy.lib.npyio.DataSource.open#

method

lib.npyio.DataSource.open(path, mode='r', encoding=None, newline=None)[原始碼]#

Open and return file-like object.

If path is a URL, it will be downloaded, stored in the DataSource directory and opened from there.

Parameters:
pathstr or pathlib.Path

Local file path or URL to open.

mode{『r』, 『w』, 『a』}, optional

Mode 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』.

encoding{None, str}, optional

Open text file with given encoding. The default encoding will be what open uses.

newline{None, str}, optional

Newline to use when reading text file.

Returns:
outfile object

File object.