string formatting with mapping & '*'... is this a bug?

Pierre Fortin pfortin at pfortin.com
Sat Sep 11 02:49:17 CEST 2004


On Fri, 10 Sep 2004 11:40:48 -0400 I responded to Alex:

> On Fri, 10 Sep 2004 16:34:31 +0200 Alex wrote:
> > Come to think of that, you SHOULD hoist the "real format" out of the
> > loop,
> 
> That's a given in my book... :>

SHEESH!!!  Just now dawned on me what you really meant...

# hoist *this* part of the formatting code...!
format = ( "%(Date)ss %(Open)sf %(High)sf %(Low)sf "
           "%(Close)sf %(Volume)sd %(AdjClose)sf %(Change)ss"
            % fmt )

for ...:
    ...
    print format % map

At least I'm getting it...  :>

Pierre
-30-



More information about the Python-list mailing list