quoting %
Andreas Kostyrka
andreas at kostyrka.org
Wed Oct 13 10:27:10 EDT 2004
On Wed, Oct 13, 2004 at 01:32:38PM +0200, Matthias Teege wrote:
>
> Moin,
>
> 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?
Try: "'%%%s%%'"
And if your not completly sure what type value might be, it's better
to use str % (value,) (Hint: what happens if type(value) == tuple)?
Andreas
>
> Matthias
> --
> Matthias Teege -- http://www.mteege.de
> make world not war
> --
> http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list