Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
witten
on July 28, 2008
|
parent
|
context
|
favorite
| on:
Yet Another Review/Rate My Startup Request
Thanks, I appreciate it. I think I got a little over-zealous in escaping my %s.
Interestingly, in Python, "%%%s" % "foo" != "%%foo"
lacker
on July 28, 2008
[–]
It works just like \ in standard unix parsing - you escape the escape character by doubling it. So in "%%%s":
"%%" -> "%" "%s" -> "foo"
for a result of "%foo".
witten
on July 28, 2008
|
parent
[–]
Right, but the escaping by doubling does not work in Python unless it's in a format string. So "%%foo" does not count as escaped. That's what threw me off.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
Interestingly, in Python, "%%%s" % "foo" != "%%foo"