Skip to content

Instantly share code, notes, and snippets.

@rg3915
Created November 29, 2023 06:01
Show Gist options
  • Save rg3915/97e9afcb67f4de4a4e33995bbcc87976 to your computer and use it in GitHub Desktop.
Save rg3915/97e9afcb67f4de4a4e33995bbcc87976 to your computer and use it in GitHub Desktop.
namedtuple example
from collections import namedtuple
data = ('Regis', 'Santos', '[email protected]')
first_name, last_name, email = data
print(first_name, last_name, email)
Person = namedtuple('Person', ['first_name', 'last_name', 'email'])
person = Person(*data)
print(person.first_name)
print(person.last_name)
print(person.email)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment