numpy保存/读取pickle

举个例子:

import numpy as np
import pickle

array = np.array([1, 2, 3, 4, 5])
array2 = np.array(['a', 'b', 'c', 'd', 'e'])

写入 pickle

with open('array.pkl', 'wb') as file:
    pickle.dump(array, file)
    pickle.dump(array2, file)

读取pickle

with open('array.pkl', 'rb') as file:
    array_1 = pickle.load(file)
    array_2 = pickle.load(file)

你可能感兴趣的:(python,python)