How to use np.save to save files in different directory in python? How to use np.save to save files in different directory in python? numpy numpy

How to use np.save to save files in different directory in python?


From the (DOCS):

file : file, str, or pathlib.Path

File or filename to which the data is saved. If file is a file-object, then the filename is unchanged. If file is a string or Path, a .npy extension will be appended to the file name if it does not already have one.

This states that if the filename has a directory (ie: Path), it will be stored there. So something like this should do what you need:

import osnp.save(os.path.join('Check', 'train_set'), training)