Created
August 10, 2012 18:46
-
-
Save akaptur/3316675 to your computer and use it in GitHub Desktop.
String formatting with % in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>>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