Printing "%"

Erik Max Francis max at alcyone.com
Thu Mar 29 11:03:20 EST 2001


Mix wrote:

> How do you print a percenrage (%)sign in Python?
> I tried :
>   return "select * from fax where id LIKE '%s\%'" %ident

Use %% instead:

Python 2.0 (#5, Nov 10 2000, 21:47:15) 
[GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> "We're at %f%%" % 200
"We're at 200.000000%"

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ People are taught to be racists.
\__/ Jose Abad
    Esperanto reference / http://mirror/alcyone/max/lang/esperanto/
 An Esperanto reference for English speakers.



More information about the Python-list mailing list