from collections import namedtuple

# Basic example
Point = namedtuple('Point', ['x', 'y'])
p = Point(11, y=22)
print(p[0] + p[1])

x, y = p
print(x, y)
print(p.x + p.y)
print(Point(x=11, y=22))

from collections import namedtuple
import csv
f = open("users.csv", "r")
next(f)
reader = csv.reader(f)
student_list = []
for row in reader:
    student_list.append(row)
    print(row)
print(student_list)

columns = ["user_id", "integration_id", "login_id", "password", "first_name",
            "last_name", "full_name", "sortable_name", "short_name",
            "email", "status"]
Student = namedtuple('Student', columns)
student_namedtupe_list = []
for row in student_list:
    student = Student(*row)
    student_namedtupe_list.append(student)
print(student_namedtupe_list[0])
print(student_namedtupe_list[0].full_name)

[((4, 8, 4, 39), 'collections.namedtuple', 'namedtuple', ({(4, 19, 4, 26): '"""Point"""', (4, 28, 4, 38): "['x', 'y']"}, {}), "('Point', ['x', 'y'])", False, 'from collections import namedtuple\n'), ((17, 9, 17, 22), 'csv.reader', 'csv.reader', ({(17, 20, 17, 21): 'f'}, {}), '(f)', False, 'import csv\n'), ((27, 10, 27, 40), 'collections.namedtuple', 'namedtuple', ({(27, 21, 27, 30): '"""Student"""', (27, 32, 27, 39): 'columns'}, {}), "('Student', columns)", False, 'from collections import namedtuple\n')]