Chris Angelico writes: > Alternatively, you can split on the space and take just the very > last word: > > for data in f: > length = data.split(" ")[-1] > # process length Also, data.rsplit(' ', 1) will split data in two at the last space. help(str.rsplit)