Skip to content

Instantly share code, notes, and snippets.

@StephenFordham
Created June 9, 2022 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StephenFordham/1a22824d4457febb14262616a6f7a412 to your computer and use it in GitHub Desktop.
Save StephenFordham/1a22824d4457febb14262616a6f7a412 to your computer and use it in GitHub Desktop.
__setattr__catching_exceptions
e1 = Employees(46347832, 30, 'Bournemouth')
for key, value in e1.__dict__.items():
print('{}: {}'.format(key, value))
#Console output
TypeError: Only valid attributes of type string are accepted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment