Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #36432

Re: How to modify this script?

From Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de>
Newsgroups comp.lang.python
Subject Re: How to modify this script?
Date 2013-01-08 15:18 +0100
Organization A newly installed InterNetNews server
Message-ID <kch9so$nmo$1@r03.glglgl.gl> (permalink)
References (2 earlier) <50e97d82$0$294$14726298@news.sunsite.dk> <mailman.167.1357479855.2939.python-list@python.org> <50e9844f$0$294$14726298@news.sunsite.dk> <mailman.169.1357482034.2939.python-list@python.org> <50e98a77$0$294$14726298@news.sunsite.dk>

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-06 13:42 +0100
  Re: How to modify this script? Chris Angelico <rosuav@gmail.com> - 2013-01-06 23:52 +1100
    Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-06 14:34 +0100
      Re: How to modify this script? Chris Angelico <rosuav@gmail.com> - 2013-01-07 00:44 +1100
        Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-06 15:03 +0100
          Re: How to modify this script? Chris Angelico <rosuav@gmail.com> - 2013-01-07 01:20 +1100
            Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-06 15:30 +0100
              Re: How to modify this script? Chris Angelico <rosuav@gmail.com> - 2013-01-07 01:41 +1100
              Re: How to modify this script? Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2013-01-08 15:18 +0100
                Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-09 10:21 +0100
  Re: How to modify this script? chaouche yacine <yacinechaouche@yahoo.com> - 2013-01-06 04:58 -0800
    Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-06 14:38 +0100
      Re: How to modify this script? chaouche yacine <yacinechaouche@yahoo.com> - 2013-01-06 06:01 -0800
        Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-06 15:21 +0100
          Re: How to modify this script? chaouche yacine <yacinechaouche@yahoo.com> - 2013-01-06 07:12 -0800
            Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-07 17:42 +0100
              Re: How to modify this script? chaouche yacine <yacinechaouche@yahoo.com> - 2013-01-08 07:31 -0800
                Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-09 10:07 +0100
                Re: How to modify this script? chaouche yacine <yacinechaouche@yahoo.com> - 2013-01-09 02:23 -0800
                Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-09 12:04 +0100
                Re: How to modify this script? chaouche yacine <yacinechaouche@yahoo.com> - 2013-01-09 10:25 -0800
                Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-11 05:35 +0100
  Re: How to modify this script? Subimal Deb <subimal.deb@gmail.com> - 2013-01-06 06:22 -0800
    Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-06 15:40 +0100
      Re: How to modify this script? Chris Angelico <rosuav@gmail.com> - 2013-01-07 01:52 +1100
        Re: How to modify this script? Kurt Hansen <kurt@ugyldig.invalid> - 2013-01-06 16:05 +0100
  Re: How to modify this script? Gertjan Klein <gklein@xs4all.nl> - 2013-01-07 18:56 +0100
    Re: How to modify this script? Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2013-01-08 15:22 +0100
      Re: How to modify this script? Gertjan Klein <gklein@xs4all.nl> - 2013-01-08 17:22 +0100

csiph-web