Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #37783
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder1.news.weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <nikos.gr33k@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'value,': 0.03; 'attribute': 0.05; 'column': 0.07; 'correct.': 0.07; 'data:': 0.07; 'only,': 0.07; "'''": 0.09; 'separately': 0.09; 'to:addr:comp.lang.python': 0.09; 'url:%s': 0.09; 'cc:addr:python- list': 0.10; '(the': 0.15; 'charset:iso-8859-7': 0.15; 'count)': 0.16; 'hits': 0.16; 'initially,': 0.16; 'item)': 0.16; 'only?': 0.16; 'row': 0.16; 'seperate': 0.16; 'subject:Formatting': 0.16; 'url)': 0.16; 'wrote:': 0.17; 'jan': 0.18; 'skip:= 10': 0.20; 'posted': 0.22; 'work,': 0.22; 'cc:2**1': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'values': 0.26; 'am,': 0.27; 'cc:addr:gmail.com': 0.27; 'coded': 0.29; 'print': 0.32; 'right?': 0.33; 'code:': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'too.': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 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; 'possible.': 0.38; 'apply': 0.39; 'link': 0.60; 'email addr:yahoo.com': 0.61; 'within': 0.64; '2013': 0.84; 'subject:value': 0.84; 'url:show': 0.84; 'joel': 0.91 |
| X-Received | by 10.49.63.164 with SMTP id h4mr2055513qes.39.1359312295664; Sun, 27 Jan 2013 10:44:55 -0800 (PST) |
| Newsgroups | comp.lang.python |
| Date | Sun, 27 Jan 2013 10:44:55 -0800 (PST) |
| In-Reply-To | <mailman.1116.1359311811.2939.python-list@python.org> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=94.68.70.179; posting-account=DYJQ-woAAACEPH85Au2BhUVfFTfSfVa4 |
| References | <6ad78df4-0ec0-4760-8f5a-5ecf129c5e65@googlegroups.com> <mailman.1086.1359223462.2939.python-list@python.org> <d543dccf-af7a-4efd-adc5-13d9ef080c1e@googlegroups.com> <mailman.1090.1359239220.2939.python-list@python.org> <a8690843-35b0-423e-a79d-f2b6c1991be6@googlegroups.com> <63edba3c-55af-4c4c-a311-4188891bfdf0@googlegroups.com> <f0e08aad-3c69-4ba0-82d0-91652997c7d4@googlegroups.com> <mailman.1116.1359311811.2939.python-list@python.org> |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| X-Google-IP | 94.68.70.179 |
| MIME-Version | 1.0 |
| Subject | Re: Formatting a column's value output |
| From | Κώστας Παπαδόπουλος <nikos.gr33k@gmail.com> |
| To | comp.lang.python@googlegroups.com |
| Content-Type | text/plain; charset=ISO-8859-7 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | Κώστας Παπαδόπουλος <nikos.gr33k@gmail.com>, "python-list@python.org" <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 <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> |
| Message-ID | <mailman.1118.1359312305.2939.python-list@python.org> (permalink) |
| Lines | 146 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1359312305 news.xs4all.nl 6944 [2001:888:2000:d::a6]:56099 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:37783 |
Show key headers only | View raw
Τη Κυριακή, 27 Ιανουαρίου 2013 8:36:42 μ.μ. UTC+2, ο χρήστης Joel Goldstick έγραψε: > On Sun, Jan 27, 2013 at 1:05 PM, Κώστας Παπαδόπουλος <nikos...@gmail.com> wrote: > > Τη Κυριακή, 27 Ιανουαρίου 2013 6:12:59 μ.μ. UTC+2, ο χρήστης ru...@yahoo.com έγραψε: > > > > > > On 01/27/2013 02:04 AM, Ferrous Cranus wrote: > > > > > > >[...] > > > > > > > data = cur.fetchall() > > > > > > > for row in data: > > > > > > > print ( "<tr>" ) > > > > > > > > > > > > > > for item in row: > > > > > > > print( '''<td> <a href='http://www.%s?show=log'>%s</a> </td>''' % (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 to 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 = cur.fetchall() > > > > > > for row in data: > > > > > > url = row[0] > > > > > > hits = row[1] > > > > > > print ( "<tr>" ) > > > > > > print( "<td> <a href='http://www.%s?show=log'>%s</a> </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: > > print( "<td> <a href='http://www.%s?show=log'>%s</a> </td>: " % (row[0], row[1]) ) This is not correct. the <a href> attribute is for url (row[0]) only, not for url and hits too. i want the following working code: ============= data = cur.fetchall() for row in data: url = row[0] hits = row[1] print ( "<tr>" ) print( "<td> <a href='http://www.%s?show=log'>%s</a> </td>" % (url, url) ) print( "<td><b> %s </td>" % (hits) ) ============= inside the loop i posted initially, if its possible.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Formatting a column's value output Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-26 09:51 -0800
Re: Formatting a column's value output Chris Angelico <rosuav@gmail.com> - 2013-01-27 05:04 +1100
Re: Formatting a column's value output Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-26 11:41 -0800
Re: Formatting a column's value output Michael Torrie <torriem@gmail.com> - 2013-01-26 15:26 -0700
Re: Formatting a column's value output Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-27 01:04 -0800
Re: Formatting a column's value output Chris Angelico <rosuav@gmail.com> - 2013-01-27 20:08 +1100
Re: Formatting a column's value output Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-27 01:16 -0800
Re: Formatting a column's value output Chris Angelico <rosuav@gmail.com> - 2013-01-27 20:26 +1100
Re: Formatting a column's value output Κώστας Παπαδόπουλος <nikos.gr33k@gmail.com> - 2013-01-27 01:30 -0800
Re: Formatting a column's value output Κώστας Παπαδόπουλος <nikos.gr33k@gmail.com> - 2013-01-27 01:30 -0800
Re: Formatting a column's value output Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-27 01:16 -0800
Re: Formatting a column's value output rurpy@yahoo.com - 2013-01-27 08:12 -0800
Re: Formatting a column's value output Κώστας Παπαδόπουλος <nikos.gr33k@gmail.com> - 2013-01-27 10:05 -0800
Re: Formatting a column's value output Joel Goldstick <joel.goldstick@gmail.com> - 2013-01-27 13:36 -0500
Re: Formatting a column's value output Κώστας Παπαδόπουλος <nikos.gr33k@gmail.com> - 2013-01-27 10:44 -0800
Re: Formatting a column's value output Κώστας Παπαδόπουλος <nikos.gr33k@gmail.com> - 2013-01-27 10:44 -0800
Re: Formatting a column's value output rurpy@yahoo.com - 2013-01-27 11:12 -0800
Re: Formatting a column's value output Κώστας Παπαδόπουλος <nikos.gr33k@gmail.com> - 2013-01-27 12:24 -0800
Re: Formatting a column's value output Mitya Sirenef <msirenef@lightbird.net> - 2013-01-27 15:50 -0500
Re: Formatting a column's value output rurpy@yahoo.com - 2013-01-27 14:27 -0800
Re: Formatting a column's value output Κώστας Παπαδόπουλος <nikos.gr33k@gmail.com> - 2013-01-28 01:47 -0800
Re: Formatting a column's value output Κώστας Παπαδόπουλος <nikos.gr33k@gmail.com> - 2013-01-28 01:44 -0800
Re: Formatting a column's value output Κώστας Παπαδόπουλος <nikos.gr33k@gmail.com> - 2013-01-28 01:44 -0800
Re: Formatting a column's value output Virgil Stokes <vs@it.uu.se> - 2013-01-27 18:46 +0100
Re: Formatting a column's value output Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-27 01:04 -0800
Re: Formatting a column's value output Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-26 11:41 -0800
Re: Formatting a column's value output Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-26 13:07 -0800
Re: Formatting a column's value output Chris Angelico <rosuav@gmail.com> - 2013-01-27 09:18 +1100
Re: Formatting a column's value output alex23 <wuwei23@gmail.com> - 2013-01-26 15:29 -0800
Re: Formatting a column's value output Chris Angelico <rosuav@gmail.com> - 2013-01-27 10:38 +1100
Re: Formatting a column's value output Jason Friedman <jsf80238@gmail.com> - 2013-02-03 09:18 -0800
Re: Formatting a column's value output Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-04 06:39 +0000
Re: Formatting a column's value output Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-26 13:07 -0800
csiph-web