Still Question about print format?

Mike C. Fletcher mcfletch at rogers.com
Thu Nov 7 18:47:30 EST 2002


  Combine the two pieces of advice.

Your form = """
    blah
    blah
    blah
"""

includes the newline characters between blah and blah :) .  That's one 
of the major purposes of the triple-quoted string form.

form = "%(index)d%(symbol)s%(binding_file)s%(to_file)s"

HTH,
Mike

Mindy wrote:

>>If what you really wanted was to create a classic
>>"report" (static 
>>formatted output for consumption by humans), you
>>shouldn't be using tabs 
>>at all.  Look at using the string methods "center",
>>"ljust" and "rjust", 
>>which will give you your string values with
>>space-padding to be exactly 
>>a given length.
>>    
>>
>
>That's really what I want to do but I didn't explain
>it clearly. Thanks for your clarifying. I tried to use
>ljust as you said and modified my codes as the
>following. But I still couldn't get the aligned
>result. Did I mess up in any place? Thanks so much.
>
>
>        form = """
>	%(index)d
>	%(symbol)s
>	%(binding_file)s
>	%(to_file)s\n
>	"""
>
>  
>
...
_______________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://members.rogers.com/mcfletch/






More information about the Python-list mailing list