My data file looks like this:
3.6-band
6238
Over
0.5678
Over
0.6874
Over
0.7680
Over
0.7834
What I want to do is to pick out the smallest
I see some interesting solutions above. I would go for this straightforward solution. There is one problem left, which is that integers might be taken like this as well. Anyone a solution for this?
df=open('myfile.txt')
lines=df.readlines()
minval = 1e99
for n,line in enumerate(lines):
try:
val=float(line) # NB! like this, also integers will be taken.
if val < minval:
minval = val
i_min = n
except:
pass
word = lines[i_min-1]