Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'value,': 0.03; 'column': 0.07; 'data:': 0.07; '"': 0.09; "'''": 0.09; 'separately': 0.09; 'url:%s': 0.09; 'cc:addr:python-list': 0.10; '(the': 0.15; 'count)': 0.16; 'hits': 0.16; 'item)': 0.16; 'only?': 0.16; 'row': 0.16; 'seperate': 0.16; 'subject:Formatting': 0.16; 'wrote:': 0.17; 'jan': 0.18; 'email addr:gmail.com>': 0.20; 'work,': 0.22; 'cc:2**0': 0.23; '>': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'values': 0.26; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'received:209.85.212': 0.28; 'coded': 0.29; 'url:mailman': 0.29; 'skip:& 10': 0.29; "skip:' 10": 0.30; 'url:python': 0.32; 'print': 0.32; 'url:listinfo': 0.32; 'right?': 0.33; 'skip:& 20': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'too.': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'url:org': 0.36; 'possible': 0.37; 'two': 0.37; 'item': 0.37; 'rather': 0.37; 'received:209': 0.37; 'far': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'apply': 0.39; 'url:mail': 0.40; 'link': 0.60; 'email addr:yahoo.com': 0.61; 'skip:\xc2 10': 0.62; 'within': 0.64; '8bit%:100': 0.70; '8bit%:92': 0.70; '2013': 0.84; 'subject:value': 0.84; 'url:show': 0.84; 'joel': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=aZedayT+MvEUlJJ0mKjGayqbRd9jSnlSvJI3/mE3mqw=; b=zGJEEJ4fW2PDkVjvIQEh3T2HgazvbfnhnU3927FqScqrm6Ok9H6/v5jvRIUQnu+2wA Rt48pCHrRWMCwFDbytoAJrJEj2lGoyNVYXdLniXS65txwIHxsxBJyC8EIFROWlJLaQDK YPhNVnf7OwjIeYMnsAfUokW0anQY1qmRd6q9eJ+95vaCKkPLigRUKZJwVxvpmAVIAWjt T6uM/wf4yTm4fDRcNA2d5fuDr5jv24JTaqjwCsDACKSwIOhnxaLU2WbQcqzHuzGiOfI0 lZsqM6kaC+7arwwub5IMmb4wKhrxf04+JA7vwBy+xY9a4zBWsawYI8IxfI61OuyhF9Rf 4M8w== MIME-Version: 1.0 X-Received: by 10.52.19.200 with SMTP id h8mr4517983vde.60.1359311802298; Sun, 27 Jan 2013 10:36:42 -0800 (PST) In-Reply-To: References: <6ad78df4-0ec0-4760-8f5a-5ecf129c5e65@googlegroups.com> <63edba3c-55af-4c4c-a311-4188891bfdf0@googlegroups.com> Date: Sun, 27 Jan 2013 13:36:42 -0500 Subject: Re: Formatting a column's value output From: Joel Goldstick To: =?UTF-8?B?zprPjs+Dz4TOsc+CIM6gzrHPgM6xzrTPjM+Azr/Phc67zr/Pgg==?= Content-Type: multipart/alternative; boundary=20cf307ca04c1d6f3104d4497192 Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list 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: 184 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1359311811 news.xs4all.nl 6917 [2001:888:2000:d::a6]:50765 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:37781 --20cf307ca04c1d6f3104d4497192 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sun, Jan 27, 2013 at 1:05 PM, =CE=9A=CF=8E=CF=83=CF=84=CE=B1=CF=82 =CE= =A0=CE=B1=CF=80=CE=B1=CE=B4=CF=8C=CF=80=CE=BF=CF=85=CE=BB=CE=BF=CF=82 wrote: > =CE=A4=CE=B7 =CE=9A=CF=85=CF=81=CE=B9=CE=B1=CE=BA=CE=AE, 27 =CE=99=CE=B1= =CE=BD=CE=BF=CF=85=CE=B1=CF=81=CE=AF=CE=BF=CF=85 2013 6:12:59 =CE=BC.=CE=BC= . UTC+2, =CE=BF =CF=87=CF=81=CE=AE=CF=83=CF=84=CE=B7=CF=82 > ru...@yahoo.com =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5: > > On 01/27/2013 02:04 AM, Ferrous Cranus wrote: > > > > >[...] > > > > > data =3D cur.fetchall() > > > > > for row in data: > > > > > print ( "" ) > > > > > > > > > > for item in row: > > > > > print( ''' %s > ''' % (item, item) ) > > > > >[...] > > > > > Okey, so far BUT i want the url linking to happen only for the URL > column's > > > > > value, and not for the hits column too. How do i apply the url link t= o > the > > > > > URL column's value only? > > > > > > > > Ferrous, > > > > > > > > 'row' has two items (the url and the hit count) in it, right? > > > > So print each separately rather than in a loop: > > > > > > > > data =3D cur.fetchall() > > > > for row in data: > > > > url =3D row[0] > > > > hits =3D row[1] > > > > print ( "" ) > > > > print( " %s : % > (url, hits) ) > > Yes that can work, but i want to ask you if its possible to do the same > thing from within the loop as i have it coded it until now. > > Is there a way to seperate the values within the loop? > for row in data: print( " %s : " % (row[0], row[1]) ) > -- > http://mail.python.org/mailman/listinfo/python-list > --=20 Joel Goldstick http://joelgoldstick.com --20cf307ca04c1d6f3104d4497192 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable



On Sun, Jan 27, 2013 at 1:05 PM, =CE=9A=CF=8E=CF=83=CF=84=CE=B1=CF= =82 =CE=A0=CE=B1=CF=80=CE=B1=CE=B4=CF=8C=CF=80=CE=BF=CF=85=CE=BB=CE=BF=CF= =82 <nikos.gr33k@gmail.com> wrote:
=CE=A4=CE=B7 =CE=9A=CF=85= =CF=81=CE=B9=CE=B1=CE=BA=CE=AE, 27 =CE=99=CE=B1=CE=BD=CE=BF=CF=85=CE=B1=CF= =81=CE=AF=CE=BF=CF=85 2013 6:12:59 =CE=BC.=CE=BC. UTC+2, =CE=BF =CF=87=CF= =81=CE=AE=CF=83=CF=84=CE=B7=CF=82 ru...@= yahoo.com =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5:
> On 01/27/2013 02:04 AM, Ferrous Cranus wrote: >
> >[...]
>
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 data =3D cur.fetchall()=
>
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 for row in data:
>
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 print ( "<tr>" )
>
> >
>
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 for item in row:
>
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 print( '''<td> =C2=A0&= lt;a href=3D'http://www.%= s?show=3Dlog'>%s</a> =C2=A0</td>''' % (item,= item) )
>
> >[...]
>
> > Okey, so far BUT i want the url linking to happen only for the UR= L column's
>
> > value, and not for the hits column too. How do i apply the url li= nk to the
>
> > URL column's value only?
>
>
>
> Ferrous,
>
>
>
> 'row' has two items (the url and the hit count) in it, right?<= br> >
> So print each separately rather than in a loop:
>
>
>
> =C2=A0 =C2=A0 data =3D cur.fetchall()
>
> =C2=A0 =C2=A0 for row in data:
>
> =C2=A0 =C2=A0 =C2=A0 url =3D row[0]
>
> =C2=A0 =C2=A0 =C2=A0 hits =3D row[1]
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 print ( "<tr>" )
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 print( "<td> =C2=A0<a href= =3D'http://www.%s?show=3D= log'>%s</a> =C2=A0</td>: % (url, hits) )

Yes that can work, but i want to ask you if its possible to do = the same thing from within the loop as i have it coded it until now.

Is there a way to seperate the values within the loop?

for row in data:
=C2=A0 =C2=A0 print( "&= lt;td> =C2=A0<a href=3D'http://www.%s?show=3Dlog'>%s</a> =C2=A0</td>: "= ; % (row[0], row[1]) )
--
http://mail.python.org/mailman/listinfo/python-list



--
--20cf307ca04c1d6f3104d4497192--