joblib.load
时间: 2023-11-06 20:12:28 浏览: 30
joblib.load is a function provided by the joblib library in Python. It is used to load data that was previously saved using the joblib.dump() function. The joblib.load() function reads data from a file and returns the corresponding Python object.
Syntax: joblib.load(filename)
Parameters:
- filename: A string representing the file name or path from which the data is to be loaded.
Return value: It returns the Python object that was saved in the file.
Example:
```
import joblib
# Saving a list of strings to a file
data = ['apple', 'banana', 'cherry']
joblib.dump(data, 'fruits.joblib')
# Loading the saved data from the file
loaded_data = joblib.load('fruits.joblib')
print(loaded_data) # Output: ['apple', 'banana', 'cherry']
```