Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, John > Machin wrote: > > > Lawrence D'Oliveiro wrote: > >> In message <[EMAIL PROTECTED]>, John > >> Machin wrote: > >> > >> > 1. Reasoning: How do you get a literal "'" into an SQL string constant? > >> > How do you get a literal "\" into a Python string constant? How do you > >> > get a literal "$" into some *x shell command lines? Do you detect a > >> > pattern? > >> > >> None of which applies to escaping of % characters in format strings. > > > > What I had in mind was: > > > > where surname = 'O''REILLY' > > install_dir = "C:\\Python25" > > ... > > print "The interest rate is %.2f%% p.a." % (rate * 100.0) > > > > the common pattern being that the problem character is doubled. > > Which doesn't apply to the "$" character in *nix shell command lines.
I'll take your word for it; it's been quite a while :-) *Something* in the dim dark past worked like that; I thought maybe I was thinking of m4, but that gets by without doubling. Your score so far is 1 out of 3; you have two more to go to match your original assertion "None of which applies...." Cheers, John -- http://mail.python.org/mailman/listinfo/python-list