.format vs. %

davidfx dgeorge29ca at gmail.com
Sat Dec 31 13:19:34 EST 2011


Hello everyone,
I just have a quick question about .format and %r %s %d.  

Should we always be using .format() for formatting strings or %?

Example a = 'apples'
              print "I love {0}.".format(a)

If I wanted to put .format into a variable, how would I do that.

Thanks for your information in advance.

David



More information about the Python-list mailing list