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


Groups > comp.lang.python > #36239

Re: How to modify this script?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feed.xsnews.nl!border-2.ams.xsnews.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <yacinechaouche@yahoo.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'output': 0.04; 'modify': 0.05; 'skip:$ 30': 0.07; 'subject:How': 0.09; 'lines:': 0.09; 'subject:script': 0.09; 'kurt': 0.11; 'programmer': 0.11; 'advance.': 0.15; 'modification': 0.15; "'';": 0.16; "(i'm": 0.16; 'columns': 0.16; 'script?': 0.16; 'test.': 0.17; 'to:name:python- list@python.org': 0.20; '&gt;': 0.23; 'to:2**1': 0.23; 'header:In- Reply-To:1': 0.25; 'to?': 0.27; 'lines': 0.28; 'url:mailman': 0.29; 'convert': 0.29; 'skip:& 10': 0.29; "skip:' 10": 0.30; 'url:python': 0.32; 'skip:_ 30': 0.32; 'url:listinfo': 0.32; 'to:addr:python-list': 0.33; 'skip:& 20': 0.33; 'text': 0.34; 'reply-to:addr:yahoo.com': 0.34; 'table': 0.35; 'subject:?': 0.35; 'subject:': 0.36; 'url:org': 0.36; 'apple': 0.36; 'email addr:python.org': 0.36; 'thank': 0.36; 'item': 0.37; 'sent:': 0.37; 'subject:: ': 0.38; 'green': 0.38; 'from:': 0.38; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'first': 0.61; 'email name:python-list': 0.62; 'price': 0.66; 'url:content': 0.66; 'header:Reply-To:1': 0.68; 'received:41': 0.73; 'subject:this': 0.84; '2013': 0.84
X-Yahoo-Newman-Property ymail-3
X-Yahoo-Newman-Id 861621.96957.bm@omp1031.mail.ne1.yahoo.com
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1357477095; bh=2hKgzoUcHk/+UHbfLtu+/girWZ1O0HeO/XtlaJQhJsc=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=zB9iyH+46bhXVpdhXW0trn+ihUU10BUFQLBYkXTWRqGeXtVvg9e92BxysQHUZj/wgsXy9sPLK1SkxhXZBHVn6M9drlbvX0pqFnyrc5ag8oTBEBKrXJLgjLEmHNNzbxiuAn/hGXF5OEKbXMJhphKd6ZOHXGIL61YI+/3Kv7ZLnrk=
DomainKey-Signature a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=yVFcZMdxQco/D2oEssJOtFEBaTpIB7Thc8qh2kbzP61W26KWywisgirIsMN6u9m+kcR/8P9GMegECqa3FQnQosT+HNw7o3//LZPYxL62Rhr0cp0bG4PTQ12qvNSJh8ouS5d8ihEUqoc0h0ZsocYu3G4iD9wNfskh1BI3eU/xO/8=;
X-YMail-OSG 95VBycIVM1lpp3nOsa6r2BbowpIK3Mxpa55854It19uYPdV kMhIt2gp4iBswTHz4Fmx1DwRbRoGJKsoWUHLTGMdJnUoZoVSmVmDC.c51M2J IbVICqLNtPaDf0oZfGCsiV2P_48ETsn1mNMD.9UwhH7PPnsClBnedtUBOJKw EIhdyUKR4GT.9pQjLSU5td5ta2fel6gVf3E_3.XmLSnvCHTUZd.jcnHx4agY rZxRmL9GqI6MK7lDgcUx0Xakl2AuVRp7SHBq_XcO5OuXMtaNfECGg3ctlYPU cg5dOnZZMTR7TIsiRcW94lDr4QvdQi8jfeOXj5861Prji9AkDx4bySYo4_Zd GclNEPVkIOVldgtF_sDR6Qq6Q89hVA8YhMGWv.FrNbLmJdFfDorzp.sy8MeB MDs07fcI5axyPEatXcSJwF6GwHlZ7i6QsaQnttWZtHx_m5hMoJY.DZWYqzGs QO.CYYsHYHSHZX5zN.5AGmX2AIcDcVLxw9glgjv.6JRidhu0gIKGO_W3IBde jHXSSHRyX0fGzEfBI8BiraaH.MTdhPrIPt6zJt3bjxsMKFzDOvLvTrdYHkCV EF9dthyoBN4IwzUR_MSE1doOgkgVAZMas7f8v4bqKRAGjCkU3HCaz2W7IOKA Dn6Bexm1k3z_jKA6c
X-Rocket-MIMEInfo 001.001, aWYgbGVuKGNvbHVtbnMpICE9IDM6CsKgwqAgY29sc3BhbiA9IDMgLSBsZW4oY29sdW1ucykgKyAxCsKgwqAgb3V0cHV0ICs9ICc8dGQgY29sc3Bhbj0lcz4nICUgKGNvbHNwYW4pICsgaXRlbSArICc8L3RkPiAnCgpJIGRpZCBub3QgdGVzdC4gVXNlIHdpdGggY2F1dGlvbi4KCgoKCl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCiBGcm9tOiBLdXJ0IEhhbnNlbiA8a3VydEB1Z3lsZGlnLmludmFsaWQ.ClRvOiBweXRob24tbGlzdEBweXRob24ub3JnIApTZW50OiBTdW5kYXksIEphbnVhcnkgNiwgMjABMAEBAQE-
X-Mailer YahooMailWebService/0.8.129.483
References <50e97123$0$294$14726298@news.sunsite.dk>
Date Sun, 6 Jan 2013 04:58:15 -0800 (PST)
From chaouche yacine <yacinechaouche@yahoo.com>
Subject Re: How to modify this script?
To Kurt Hansen <kurt@ugyldig.invalid>, "python-list@python.org" <python-list@python.org>
In-Reply-To <50e97123$0$294$14726298@news.sunsite.dk>
MIME-Version 1.0
Content-Type multipart/alternative; boundary="318864283-1694499169-1357477095=:14190"
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To chaouche yacine <yacinechaouche@yahoo.com>
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.161.1357477260.2939.python-list@python.org> (permalink)
Lines 61
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1357477260 news.xs4all.nl 6858 [2001:888:2000:d::a6]:54537
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:36239

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

if len(columns) != 3:
   colspan = 3 - len(columns) + 1
   output += '<td colspan=%s>' % (colspan) + item + '</td> '

I did not test. Use with caution.




________________________________
 From: Kurt Hansen <kurt@ugyldig.invalid>
To: python-list@python.org 
Sent: Sunday, January 6, 2013 1:42 PM
Subject: How to modify this script?
 
http://www.tuxradar.com/content/save-time-gedit-snippets:

To convert tab-separated text lines into a HTML-table:

$<
lines = $GEDIT_SELECTED_TEXT.split("\n");
output = '<table\>\n';

for line in lines:
    output += '<tr\>';
    
    columns = line.split("\t");
    for item in columns:
        output += '<td\>' + item + '</td\> '
    
    output += '</tr\>\n';

output += '</table\>';
return output
>

I would like to make a small modification (I'm not a programmer myself). Let's say I have these lines:

Price table
1 <tab> Green apple <tab> $1
5 <tab> Green apples <tab> $4
10 <tab> Green apples <tab> $7

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.
-- Venlig hilsen
Kurt Hansen
-- http://mail.python.org/mailman/listinfo/python-list

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