Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'value,': 0.03; 'column': 0.07; 'data:': 0.07; "'''": 0.09; 'separately': 0.09; 'url:%s': 0.09; '(the': 0.15; 'count)': 0.16; 'hits': 0.16; 'item)': 0.16; 'only?': 0.16; 'row': 0.16; 'subject:Formatting': 0.16; 'track.': 0.16; 'wrote:': 0.17; 'to:name:python-list@python.org': 0.20; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'feedback': 0.30; 'print': 0.32; 'hopefully': 0.33; 'right?': 0.33; 'to:addr:python-list': 0.33; 'too.': 0.35; 'but': 0.36; 'two': 0.37; 'item': 0.37; 'rather': 0.37; 'far': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'apply': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'help': 0.40; 'link': 0.60; 'email addr:yahoo.com': 0.61; 'subject:value': 0.84; 'url:show': 0.84 X-SENDER-IP: [213.112.54.248] X-LISTENER: [smtp.bredband.net] X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AncVAJhmBVHVcDb4PGdsb2JhbAANOIV/pgOSdAMBAQEBOIJSAQEBAQM4QBELGAkWDwkDAgECATECEgYNBgIBAYd7A6wRkkmMEIUQA5Q7jQiICg X-IronPort-AV: E=Sophos;i="4.84,548,1355094000"; d="scan'208";a="267866271" Date: Sun, 27 Jan 2013 18:46:24 +0100 From: Virgil Stokes User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:19.0) Gecko/20130117 Thunderbird/19.0 MIME-Version: 1.0 To: "python-list@python.org" Subject: Re: Formatting a column's value output References: <6ad78df4-0ec0-4760-8f5a-5ecf129c5e65@googlegroups.com> <63edba3c-55af-4c4c-a311-4188891bfdf0@googlegroups.com> In-Reply-To: <63edba3c-55af-4c4c-a311-4188891bfdf0@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1359309930 news.xs4all.nl 6875 [2001:888:2000:d::a6]:38697 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:37780 On 27-Jan-2013 17:12, rurpy@yahoo.com wrote: > On 01/27/2013 02:04 AM, Ferrous Cranus wrote: >> [...] >> data = 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 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 ( "" ) > print( " %s : % (url, hits) ) It is nice to see some constructive feedback to Ferrous from the python-list. This will hopefully help to get Ferrous on the right track.