Steven D'Aprano wrote:
> On Fri, 09 Feb 2007 14:15:51 +0000, Steve Holden wrote:
> 
>> area_name_string = '*% s*' % (Area_name)
>>
>> Interesting, I never realised until now that you can have spaces between 
>> the percent sign and th format effector.
> 
> Space is one of the flags. From the docs:
> 
> 
> The conversion flag characters are:
> 
> Flag  Meaning
> #     The value conversion will use the ``alternate form'' (where defined
>         below).
> 0     The conversion will be zero padded for numeric values. 
> -     The converted value is left adjusted (overrides the "0" conversion if
>         both are given).
>       (a space) A blank should be left before a positive number (or empty
>       string) produced by a signed conversion.
> +     A sign character ("+" or "-") will precede the conversion (overrides a
>         "space" flag).
> 
> 
> http://docs.python.org/lib/typesseq-strings.html
> 
  >>> "% s" % 'banana'
'banana'
  >>> "% s" % 1
'1'
  >>> "% s" % -1
'-1'
  >>>

Since it appears non-operative in the case of strings I'd be tempted to 
leave it out, though my original post was triggered by my surprise that 
I'd not seen the feature before. There are no limits to my ignorance :)

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb     http://del.icio.us/steve.holden
Blog of Note:          http://holdenweb.blogspot.com
See you at PyCon?         http://us.pycon.org/TX2007

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to