我必须像这样腌制一组对象:
import cPickle as pickle
from numpy import sin, cos, array
tmp = lambda x: sin(x)+cos(x)
test = array([[tmp,tmp],[tmp,tmp]],dtype=object)
pickle.dump( test, open('test.lambda','w') )
它给出了以下错误:
TypeError: can't pickle function objects
有办法解决吗?