Oct-13-2020, 07:49 AM
I'm wondering if there is a way where I can grab where I can grab an email from a class with in put from a name I know I can do this from making a list with the contact from the class but I have been driving myself crazy because I'm basically making a contact list twice and I feel like there definite has to be a better way
so basically from the code I will import as an example I want to have an input like input("send to: ") and I type in John Doe and get his email from the Contact class so I can use it for smtplib
so basically from the code I will import as an example I want to have an input like input("send to: ") and I type in John Doe and get his email from the Contact class so I can use it for smtplib
class Contacts: contactCont= 0 def __init__(self, first_name,last_name, email): self.first_name=first_name self.last_name=last_name self.email=email Contacts.contactCont +=1 def display_contact(self): print("First Name:", self.first_name, self.last_name, ", Email:", self.email) john = Contacts("john", "Doe", "[email protected]")