我似乎无法弄清楚如何再次正确关闭腌制文件,包括添加的行。它一直给我错误:" TypeError:参数必须有'写'属性"
import cPickle
f = cPickle.load(open('plugin/mat.lib','r'))
f += ( (len(f), 0, 'Materialname', 1, {'Data Source': 'Imported from CAE', 'Description': 'Imported from CAE', 'Time Stamp': 1463641234.541, 'visible': ['Data Source', 'Description', 'Units', 'Vendor material name'], 'version': '6-14', 'Vendor material name': 'Materialname', 'Units': 'Imported from CAE', 'Data': "{'name': Materialname, 'materialIdentifier': '', 'description': '', 'elastic': {'temperatureDependency': OFF, 'moduli': LONG_TERM, 'noCompression': OFF, 'noTension': OFF, 'dependencies': 0, 'table': ((137.881411608, 137.881411608, 73248.8672315, 0.580513190738, 0.000665780085056, 0.000665780085056, 43.6191904048, 63.1280026653, 63.1280026653),), 'type': ENGINEERING_CONSTANTS}, 'density': {'temperatureDependency': OFF, 'table': ((5.4749e-09,),), 'dependencies': 0, 'fieldName': '', 'distributionType': UNIFORM}}"}), )
cPickle.dump(f, 'plugin/mat.lib')