Printing a percent sign

Rob Williscroft rtw at freenet.co.uk
Mon Sep 25 16:47:37 EDT 2006


Rob Williscroft wrote in news:Xns9849DC7DB4102rtwfreenetREMOVEcouk@
216.196.109.145 in comp.lang.python:

>  wrote in news:1159216705.649649.116260 at d34g2000cwd.googlegroups.com in 
> comp.lang.python:
> 
>> Hi all. How do I escape the "%" sign in a print statement so that it
>> prints? Thanks.
>> 
> 
> print "%%"
> 

Ok, confused by the simplicity of the question.

Real answer is:

print "%"

But the real question was "how to print a % whern doing % formating",

acuracy = 100
print "this is %d%% more acurate than my previous answer" % acuracy 


Rob.
-- 
http://www.victim-prime.dsl.pipex.com/



More information about the Python-list mailing list