Am 06.01.2013 15:30 schrieb Kurt Hansen:
Den 06/01/13 15.20, Chris Angelico wrote:
On Mon, Jan 7, 2013 at 1:03 AM, Kurt Hansen <kurt@ugyldig.invalid> wrote:
I'm sorry to bother you, Chris, but applying the snippet with your
code in
Gedit still just deletes the marked, tab-separated text in the editor.

Ah, whoops. That would be because I had a bug in the code (that's why
I commented that it was untested). Sorry about that! Here's a fixed
version:

[cut]>
Note that it's a single line:

output += '<td colspan="' + str(4-len(columns)) + '"\>' + item +
'</td\> '

If your newsreader (or my poster) wraps it, you'll need to unwrap that
line, otherwise you'll get an IndentError.

Ahhh, I did'nt realize that. Now it works :-)

That version should work.

It certainly does. I'll keep it and use it until at better solution is
found.

That would be simple:

Replace

output += '<td colspan="' + str(4-len(columns)) + '"\>' + item +
'</td\> '

with

if len(columns) >= 3:
    output += '<td\>'
else:
    output += '<td colspan="' + str(4-len(columns)) + '"\>'
output += item + '</td\> '

(untested as well; keep the indentation in mind!)


Thomas
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to