Skip to content

Instantly share code, notes, and snippets.

@sit
Created September 23, 2013 14:05
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 sit/6670869 to your computer and use it in GitHub Desktop.
Save sit/6670869 to your computer and use it in GitHub Desktop.
#
# Ways of stringifying Hello World in Python
#
a = "hello"
b = "world"
"%s %s" % (a, b)
"%(a)s %(b)s" % locals()
"{a} {b}".format(**locals())
"{first} {second}".format(first=a, second=b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment