Skip to content

Instantly share code, notes, and snippets.

@akaptur
Created August 10, 2012 18:46
Show Gist options
  • Save akaptur/3316675 to your computer and use it in GitHub Desktop.
Save akaptur/3316675 to your computer and use it in GitHub Desktop.
String formatting with % in python
>>>a = '%s'
>>>a %= 1 # equivalently, a = a % 1
>>>a == '1'
True
# A more clear version
>>> f = '%s' % 1
>>> f
'1'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment