How to modify this script?

Kurt Hansen kurt at ugyldig.invalid
Sun Jan 6 09:40:34 EST 2013


Den 06/01/13 15.22, Subimal Deb wrote:
> Kurt,
> Try this:
>
[cut]

I've tested it on my original example:

Price table
1	Green apple	$1
5	Green apples	$4
10	Green apples	$7

With all four lines selected it makes an error. With only three (without 
the first line) it works all right.

The error message says:

Execution of the Python command (lines = 'Price table\n1\tGreen 
apple\t$1\n5\tGreen apples\t$4\n10\tGreen apples\t$7'.split("\n");
output = '<table>\n';

for line in lines:
         output += '<tr>';

         columns = line.split("\t");
	if len(columns)==1:
		output += '<tr><td colspan="3">', line, '</td></tr>'
	else:
	        for item in columns:
         	        output += '<td>' + item + '</td> '

         output += '</tr>\n';

output += '</table>';
return output) failed: cannot concatenate 'str' and 'tuple' objects
-- 
Venlig hilsen
Kurt Hansen



More information about the Python-list mailing list