how to extract a variable as parameter which has index using by a for loop?

meInvent bbird jobmattcon at gmail.com
Wed Jun 8 03:31:29 EDT 2016


b = [str(i)+str(j)+str(k) for i in range(m) for j in range(m) for k in range(m)]
b[21][0:1]+b[21][1:2]
b[21][1:2]+b[21][2:3]
b[21][0:1]+b[21][2:3]


originally,

mmm = 5
H2 = [MM[mmm][b[i][0:1]+b[i][1:2]] for i in range(len(b))]

how to extract b[i][0:1] and b[i][1:2] as parameters?

def node(mmm, b[i][0:1], b[i][1:2]):
 H2 = [MM[mmm][A+B] for i in range(len(b))]
 return H2

node(5, b[i][0:1], b[i][1:2])


More information about the Python-list mailing list