Collections.namedtuple()

  • + 0 comments

    Something I learned while solving this is that namedtuples have a ._make method that if the input string is in the same order as the namedtuple defintion string, it does the right thing:

    Record = namedtuple('Record', headers)
    :
    :
    read_input = input().split()
    read_record = Record._make(read_input)