from collections import namedtuple Person = namedtuple("Person", ["name", "age", "city"]) person = Person("Alice", 25, "New York") print(person.name) # Output: Alice print(person.age) # Output: 25 print(person.city) # Output: New York
Alice 25 New York