for filename in glob.glob(sys.argv[1]):
    data = []
with open(filename) as finput:
    for i, row in enumerate(csv.reader(finput)):
        to_append = 'Filename' if i == 0 else filename
data.append(row + [to_append])
with open(filename, 'wb') as foutput:
    writer = csv.writer(foutput)
for row in data:
    writer.writerow(row)
Добавить имя файла в качестве последнего столбца CSV-файла