创建具有名称的变量我想用类似于如下的实际工作的一些代码:Python从范围
P = 20
n = 1
for x in range(1, P+1):
Ax = n #Hoping that you can name the variable from the current element in the range
n = n+1
我要让可变因素A1,A2,A3 .... A20他们将有在这个例子中值为1,2,3 ... 20 ...
这是否可能,以及它需要什么编码?
干杯
你**真的**不想这样做。改用列表。[将数据保留在变量名称之外](http://nedbatchelder.com/blog/201112/keep_data_out_of_your_variable_names.html)。 –