我试图在while循环中创建固定大小的数组。因为我不知道要创建多少个数组,所以我使用一个循环在while循环中启动它们。我面临的问题是,在数组声明中,我希望每个数组的名称以while循环的索引结尾,这样以后它将对我的计算有用。我不希望找到一个简单的出路,但是如果有人能给我指出正确的方向,那就太好了
我尝试使用arrayname+str(I)。这将返回错误“cannot assign to operator”。在
#parse through the Load vector sheet to load the values of the stress vector into the dataframe
Loadvector = x2.parse('Load_vector')
Lvec_rows = len(Loadvector.index)
Lvec_cols = len(Loadvector.columns)
i = 0
while i < Lvec_cols:
y_values + str(i) = np.zeros(Lvec_rows)
i = i +1
我希望数组名为arrayname1,arrayname2。。。待创建。在
我认为这个标题有些误导。在
一种简单的方法是使用字典:
您可以通过}。在
dict_of_array[arrayname1]
访问{如果要创建一批数组,请尝试:
^{pr2}$相关问题 更多 >
编程相关推荐