Skip to content

Instantly share code, notes, and snippets.

@mriedem
Created March 9, 2016 16:36
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 mriedem/4f6ea2e61ea82d6ade6f to your computer and use it in GitHub Desktop.
Save mriedem/4f6ea2e61ea82d6ade6f to your computer and use it in GitHub Desktop.
>>> msg_fmt = "Not authorized."
>>> kwargs = {'code': 403, 'reason': ''}
>>>
>>> msg_fmt % kwargs
'Not authorized.'
>>> msg_fmt = "Not authorized: %(derp)s"
>>> msg_fmt % kwargs
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: 'derp'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment