Question about print format?

Mike C. Fletcher mcfletch at rogers.com
Thu Nov 7 17:54:30 EST 2002


If I understand correctly what you want (a standard tab-delimited output 
file), your problem is with the format you defined:
    form = """
    %(index)d\t\t
    %(symbol)s\t\t\t\t
    %(binding_file)s\t\t\t\t\t
    %(to_file)s\t\t\t\t\n
    """
You probably wanted:
    form = 
"""%(index)d\t\t%(symbol)s\t\t\t\t%(binding_file)s\t\t\t\t\t%(to_file)s\t\t\t\t\n"""
Though I have no idea why you want so _many_ tabs between items.  

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.

HTH,
Mike

If what you were looking for was to create a space-aligned format

Mindy wrote:

>Actually, I want to get a neat list of information
>about index,sybol,binding_file,to_file (which are 4
>columns). The attachment is my program and the output
>I want and I got. Could someone help me with this
>output format stuff?
>
>Thanks very much!
>
>
>
>
>
>=====
>Cheers
>-Mindy
>  
>
_______________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://members.rogers.com/mcfletch/







More information about the Python-list mailing list