quoting %

Fredrik Lundh fredrik at pythonware.com
Wed Oct 13 07:43:30 EDT 2004


Matthias Teege wrote:

> I need a string like this "foo '%value%'" for a database query but
> print "'%%s%'"%value gives me TypeError: not all arguments converted
> during string formatting. How does I quote the "%" sign in this case?

use "%%".

for the full story, see:

    http://docs.python.org/lib/typesseq-strings.html

</F> 






More information about the Python-list mailing list