Python broken %
hmurray at megapathdsl.net
Fri Sep 9 05:24:35 UTC 2016
> Python says %s(x)s works for any x that str(x) works.
That's now how I read it. I didn't find any hints that %s takes its arg as
(x) directly following the %s.
The format of the % stuff is
"string with %s and such" % arg or (args)
The arg you want to print goes on the right of the % operator, not inline in
the format string.
>>> "asdf %s asdf" % "foo"
'asdf foo asdf'
>>> "asdf %s asdf" % (13.6 * 2)
'asdf 27.2 asdf'
These are my opinions. I hate spam.
More information about the devel