Skip to content

Instantly share code, notes, and snippets.

@c0ldlimit
Created November 16, 2012 17:18
Show Gist options
  • Save c0ldlimit/4089134 to your computer and use it in GitHub Desktop.
Save c0ldlimit/4089134 to your computer and use it in GitHub Desktop.
Python: Advanced String Formatting
# http://www.python.org/dev/peps/pep-3101/
# "My name is Fred"
"My name is {0}".format('Fred')
"My name is {0.name}".format(open('out.txt', 'w'))
"My name is {0[name]}".format(dict(name='Fred'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment