Very stupid question about a % symbol

Jason Swails jason.swails at
Thu Sep 16 18:24:00 CEST 2010

Ha, I had this same problem, but I was trying to do dynamic formatting:

("%%%s" % format) % number

where "format" is a python-ized fortran format string (i.e. "9.4E").  Looks
kinda weird and less elegant than the {0:{1}}-type .format() syntax, but at
least it preserves backwards compatibility to pythons older than 2.6.
Before I found out how to cancel the %, the statement looked like ("%"+"%s"
% format) % number.  Not much of a change, but still a nice thing to know
since I play with %s a lot.

Thanks! (even though I'm not the original asker)


On Thu, Sep 16, 2010 at 12:09 PM, Grant Edwards <invalid at invalid.invalid>wrote:

> On 2010-09-16, J <dreadpiratejeff at> wrote:
> > Reported memory amounts are within 10% tolerance
> >>> "Reported memory amounts are within %d%% tolerance" % 10
> 'Reported memory amounts are within 10% tolerance'
> --
> Grant Edwards               grant.b.edwards        Yow! It's the RINSE
>                                  at               They've ALL IGNORED the
>                                RINSE CYCLE!!
> --

Jason M. Swails
Quantum Theory Project,
University of Florida
Ph.D. Graduate Student
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list