Quoting Vicki Stanfield <[EMAIL PROTECTED]>:

> > for key in form:
> > print '%s: %s' % (key, form[key].value)
> Thanks John,
> That is exactly what I was looking for. I would like to add a newline
> after each line. I tried adding a \n after the second %s, but that
> doesn't seem to work. But wait, it works interactively. Any idea why it might
> not work in this script.
> 
> for key in form:
>  print '%s: %s/n/n' % (key, form[key].value)

Hi Vicki ---

Two things:

Firstly, a there is a difference between /n and \n :-)

Secondly, remember that all whitespace (including newlines) in HTML is collapsed
down to a single space.

The newlines will be there, but your web browser is just ignoring them.  A quick
fix is something like '%s: %s<br>' % (key, form[key].value).

-- 
John.
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to