Nov-22-2017, 06:19 PM
I'm new to python, but have been coding in VBA for a while. I need to move some of my VBA code to python. So far I have this to import data from a next file and put it into a list.
md=[] """Measured depth, ft""" azi=[] """Azimuth angle angle, degrees""" inc=[] """Inclination angle, degrees""" fin = open("Wishbone 1N-24HZ.txt", "r") # open file for reading for line in fin: mds, incs, azis = line.split() md += [float(mds)] inc += [float(incs)] azi += [float(azis)] fin.close()What I am needing to do is a loop till there is no more data. In VBA it would be using an array and using a do loop until a cell is empty in the worksheet. Within the loop would be lines like: changemd(i)=md(i)-md(i-1). I'm not sure how to translate into python. One of my main issue is not being sure how to take a value from the list as well as the value before it.