print a %

David Edwards wavefrnt at tampabay.rr.com
Sat Sep 28 06:24:51 EDT 2002


On Sat, Sep 28, 2002 at 03:11:57AM -0700, Claude wrote:
> When I do 
> print "image size=%d%" %(50)
> I've got an error
> 
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> ValueError: incomplete format
> 
> I do not know how to escape the second %
> 
> print "image size=%d%" %(50) 
> image size=50%
> 

You escape the % with another %.

Like this:

print "image size=%d%%" %(50)

-- 
david edwards




More information about the Python-list mailing list