Python str.format
str.format
Pro:
- flexible format
Con:
- this is not common interface for programmer who is familiar with other language
Eg
>>> "{0} is good. {1} is better! {2} is awesomeXDDDD".format('foo', 'bar', 'baz') 'foo is good. bar is better! baz is awesomeXDDDD'
other way
Eg1
>>> "%s is %d times bettrt than %s" % ('Foo', 3, 'Bar') 'Foo is 3 times bettrt than Bar'
Eg2
>>> "two square is %d" % 2 * 2 'two square is 2two square is 2'