Skip to content

Instantly share code, notes, and snippets.

@mrmiguez
Created June 6, 2017 12:48
Show Gist options
  • Save mrmiguez/74e4893ab044a46d1ef9ff8976ce50d0 to your computer and use it in GitHub Desktop.
Save mrmiguez/74e4893ab044a46d1ef9ff8976ce50d0 to your computer and use it in GitHub Desktop.
String formatting from Kenneth Reitz
foo = 'foo'
bar = 'bar'
foobar = '%s%s' % (foo, bar) # It is OK
foobar = '{0}{1}'.format(foo, bar) # It is better
foobar = '{foo}{bar}'.format(foo=foo, bar=bar) # It is best
@mrmiguez
Copy link
Author

mrmiguez commented Jun 6, 2017

From here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment