晚上好,我有这种类型的python对象。这里有什么方法可以将其转换为String,进行编辑并转换回吗?
<class 'matplotlib.transforms.CompositeGenericTransform'>
当我通过print(variable)打印它时,它看起来像这样:
CompositeGenericTransform(CompositeGenericTransform(CompositeGenericTransform(CompositeGenericTransform(CompositeGenericTransform(TransformWrapper(BlendedAffine2D(IdentityTransform(),IdentityTransform())), CompositeGenericTransform(BboxTransformFrom(TransformedBbox(Bbox('array([[ -19.5 , -10.7983871],\n [ 221.5 , 140.7983871]])'), TransformWrapper(BlendedAffine2D(IdentityTransform(),IdentityTransform())))), BboxTransformTo(TransformedBbox(Bbox('array([[ 0.125, 0.25 ],\n [ 0.9 , 0.9 ]])'), BboxTransformTo(TransformedBbox(Bbox('array([[ 0., 0.],\n [ 8., 6.]])'), Affine2D(array([[ 80., 0., 0.],
[ 0., 80., 0.],
[ 0., 0., 1.]])))))))), Affine2D(array([[ 0.99968918, -0.02493069, 6.98903935],
[ 0.02493069, 0.99968918, -8.59039721],
[ 0. , 0. , 1. ]]))), Affine2D(array([[ 0.99968918, -0.02493069, 6.93499095],
[ 0.02493069, 0.99968918, -7.14592338],
[ 0. , 0. , 1. ]]))), Affine2D(array([[ 0.99968918, -0.02493069, 6.88226449],
[ 0.02493069, 0.99968918, -6.30113809],
[ 0. , 0. , 1. ]]))), Affine2D(array([[ 0.99968918, -0.02493069, 6.96735103],
[ 0.02493069, 0.99968918, -7.27368166],
[ 0. , 0. , 1. ]])))
您可以使用Pickle做到这一点,它是Python的对象序列化库。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句