for name in argdct['fname']:
    with open(name, 'r') as infile:
        for line in infile:
            line = str(line)
if re.search('^#', line):
    if re.search('^#A', line) != None and topcomment == None:
        topcomment = line
continue
items = line.split()
currkey = float(items[0])
if currkey in list(output.keys()):
    for ii in range(len(output[currkey])):
        output[currkey][ii] += float(items[ii + 1])
else:
    pass
объединить/усреднить несколько файлов данных