Look at EDIT in my previous post.
This code should be amended so that two first rows are ignored (where is no data). The could look like:
You can iterate over files and perform same operation, assuming that you have list of files you want to look for max value:
This code should be amended so that two first rows are ignored (where is no data). The could look like:
with open('buoys.txt', 'r') as f: rows = (row.strip() for row in f) header, header_2 = next(rows), next(rows) nums = (float(row.split()[-1]) for row in rows if float(row.split()[-1]) != 9999.0) max_value = max(nums)EDIT:
You can iterate over files and perform same operation, assuming that you have list of files you want to look for max value:
file_list = ['buoys.txt', 'buoys_2.txt'] # long list of filenames. If in one directory you can us os.listdir() to get this list file_max_values = [] for file in file_list: with open(file, 'r') as f: rows = (row.strip() for row in f) header, header_2 = next(rows), next(rows) nums = (float(row.split()[-1]) for row in rows if float(row.split()[-1]) != 9999.0) file_max_values.append(max(nums)) max_value = max(file_max_values)
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.