Using 'string.ljust' to try and hold a fixed width.......

Peter Otten __peter__ at web.de
Wed Nov 19 14:46:40 EST 2003


John F Dutcher wrote:

> Last shot ... then I'll leave you alone...I tried your 'fixedwidth'
> function.
> Almost predictably....it worked perfectly in IDLE when coded as below:
> It has no effect at all when employed in the CGI script however, (the
> returned
> values do not have trailing spaces) ??

I am now pretty sure that fixedwidth() or str.ljust() are *not* the problem
with your cgi script. Step back and look for something *completely*
different, e. g.:
- Is it an old file that you are checking for the extra spaces? 
- Do you think that print writes to a file (it can, if you do: 
  print >> destfile, "sometext")?

If you cannot track down the bug yourself, shorten the cgi script as much as
you can and post it on c.l.py. Try to describe the problem you perceive and
make as few implicit assumptions as possible, i. e. "This is my script's
output cut and pasted" rather than "It does not do what I want".

Peter




More information about the Python-list mailing list