Ask Your Question

Revision history [back]

I think the easiest thing to do, maybe the only thing to do, is to parse the name of the variable as a string. Try str(r1[0,0]).split('_'), for example. If you do a = r1[0,0], then str(a).split('_')[1:] will give you the two indices as strings, so you could do [int(s) for s in str(a).split('_')[1:]].

I think the easiest thing to do, maybe the only thing to do, is to parse the name of the variable as a string. Try str(r1[0,0]).split('_'), for example. If you do let a = r1[0,0], then str(a).split('_')[1:] will give you the two indices as strings, so you could do [int(s) for s in str(a).split('_')[1:]].