Python command to get last part file -


i have .dat file like:

step1 a1 b1 a2 b2 a3 b3

step2 a4 b4 a5 b5 . . . stepn bn bm

each step has 2 column (a , b). need scrip, looks last step , gives me "an" , "am"

thank help!

something efficient, works long files (uses no memory):

with open("data.dat") f:  # file automatically closed     line in f:  # goes through line (no need store them)         pass step, an, bn, am, bm = line.split()  # splits last line read (on spaces) 

if need convert numerical values, int(an) or float(an) work.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -