for line in open(argv[1]):
    fields = (field.strip() for field in line.split(','))
record = dict(pairwise(fields))
records[record['TSN']] = record
print('Found %d records in the file.' % len(records))
Создание словаря Python из строки текста