[英]Convert string to numpy array of arrays
I have a string representation of a numpy array of arrays.我有一个 numpy 数组数组的字符串表示形式。 How do you convert from this format to an array of arrays?
如何从这种格式转换为数组数组?
Using eval is the best solution使用 eval 是最好的解决方案
import numpy as np
a = "np.array([[1,2],[2,3]])"
a = eval(a)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.