How to modify this script?

Kurt Hansen kurt at ugyldig.invalid
Sun Jan 6 14:34:58 CET 2013


Den 06/01/13 13.52, Chris Angelico skrev:
> On Sun, Jan 6, 2013 at 11:42 PM, Kurt Hansen <kurt at ugyldig.invalid> wrote:
>> Since there's only one "field" in the first line, I want this output:
>>
>> <tr><td colspan="3">Price table</td></tr>
>>
>> - insted of
>>
>> <tr><td>Price table</td></tr>
>>
>> How to? Thank you i advance.

> It's actually quite simple, as long as you don't mind the junk of
> colspan="1" on all the other cells.

I do, but I would like to test anyway ;-)

  Just replace the innermost loop
> with:
>
>          for item in columns:
>                  output += '<td colspan="' + (4-len(columns)) + '"\>' +
> item + '</td\> '

"innermost"? I have replaced this with yours, but all the marked text 
are deleted:

for item in columns:
		output += '<td\>' + item + '</td\> '

> Untested, but it ought to work - as long as you never have _more_
> cells in the line.
-- 
Regards
Kurt Hansen



More information about the Python-list mailing list