.format vs. %

Lie Ryan lie.1296 at gmail.com
Sat Dec 31 14:34:45 EST 2011


On 01/01/2012 05:44 AM, davidfx wrote:
> Thanks for your response.  I know the following code is not going to be correct but I want to show you what I was thinking.
>
> formatter = "%r %r %r %r"
>
> print formatter % (1, 2, 3, 4)
>
> What is the .format version of this concept?
>

I don't think the (%r)epr-formatting exist anymore, so if you want to do 
that you'll need to call repr manually.




More information about the Python-list mailing list