I am reading in Python a Matlab mat
file, which contains three arrays: tom, dick and harry
. In Python, I use a for
loop which does operations on this array list. Following is the demo-code:
import scipy.io as sio
mat_contents = sio.loadmat('names.mat') # with arrays tom, dick and harry
varlist = ['tom', 'dick', 'harry']
for w in varlist:
cl = mat_contents[w]
# some more operations in the loop
Now that I have to debug and do not want to access all the three varlist
for the for
loop. How to run the for loop only for harry
? I know varlist[2]
gets me harry
, but I could not succeed getting it alone for the for
loop.