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: 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; '>': 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 Subject: Re: How to modify this script? To: Kurt Hansen , "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 List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 --318864283-1694499169-1357477095=:14190 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable if len(columns) !=3D 3:=0A=A0=A0 colspan =3D 3 - len(columns) + 1=0A=A0=A0 = output +=3D '' % (colspan) + item + ' '=0A=0AI did no= t test. Use with caution.=0A=0A=0A=0A=0A________________________________=0A= From: Kurt Hansen =0ATo: python-list@python.org =0AS= ent: Sunday, January 6, 2013 1:42 PM=0ASubject: How to modify this script?= =0A =0Ahttp://www.tuxradar.com/content/save-time-gedit-snippets:=0A=0ATo co= nvert tab-separated text lines into a HTML-table:=0A=0A$<=0Alines =3D $GEDI= T_SELECTED_TEXT.split("\n");=0Aoutput =3D '\n';=0A=0Afor line in li= nes:=0A=A0=A0=A0 output +=3D '';=0A=A0=A0=A0 =0A=A0=A0=A0 columns =3D = line.split("\t");=0A=A0=A0=A0 for item in columns:=0A=A0=A0=A0 =A0=A0=A0 ou= tput +=3D '' + item + ' '=0A=A0=A0=A0 =0A=A0=A0=A0 output +=3D '= \n';=0A=0Aoutput +=3D '';=0Areturn output=0A>=0A=0AI would l= ike to make a small modification (I'm not a programmer myself). Let's say I= have these lines:=0A=0APrice table=0A1 Green apple $1=0A5 Green apples $4=0A10 Green apples $7=0A=0ASince there's= only one "field" in the first line, I want this output:=0A=0APrice table=0A=0A- insted of=0A=0APrice table=0A=0AHow to? Thank you i advance.=0A-- Venlig hilsen=0AKurt Hansen= =0A-- http://mail.python.org/mailman/listinfo/python-list --318864283-1694499169-1357477095=:14190 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
if len(columns) !=3D = 3:
   colspan =3D 3 - len(columns) + 1
   output = +=3D '<td colspan=3D%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 scri= pt?

=0Ahttp://www.tuxradar.com/content/save-time-gedit-snippets:

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

$<
lines = =3D $GEDIT_SELECTED_TEXT.split("\n");
output =3D '<table\>\n';
=
for line in lines:
    output +=3D '<tr\>';
=    
    columns =3D line.split("\t");
=     for item in columns:
      &= nbsp; output +=3D '<td\>' + item + '</td\> '
  &nb= sp;
    output +=3D '</tr\>\n';

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

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

Price table
1 <tab> Green apple <tab> $1
5 &l= t;tab> Green apples <tab> $4
10 <tab> Green apples <ta= b> $7

Since there's only one "field" in the first line, I want th= is output:

<tr><td colspan=3D"3">Price table</td><= ;/tr>

- insted of

<tr><td>Price table</td&g= t;</tr>

How to? Thank you i advance.
-- Venlig hilsen
Ku= rt Hansen
-- http://mail.python.org/mailman/listinfo/python-list

=
--318864283-1694499169-1357477095=:14190--