Percent sign in format string?

Erik Max Francis max at alcyone.com
Thu Jul 18 20:45:12 EDT 2002


Ron Levine wrote:

> How can I put a "%" sign in a format string?
> 
> For example, x=98 and  I want to output
>  "x = 98%"
> 
> The statement
>      print "x = %d%"%x
> produces a ValueError: incomplete format string
> 
> So does the statement
>      print "x = %d\%"%x

You want:

	print "x = %d%%" % x

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ See the son in your bad day / Smell the flowers in the valley
\__/ Chante Moore
    Bosskey.net: Aliens vs. Predator 2 / http://www.bosskey.net/avp2/
 A personal guide to Aliens vs. Predator 2.



More information about the Python-list mailing list