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: 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: 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> <63edba3c-55af-4c4c-a311-4188891bfdf0@googlegroups.com> 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: =?ISO-8859-7?B?yv7z9OHyINDh8OHk/PDv9evv8g==?= To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-7 Content-Transfer-Encoding: quoted-printable Cc: =?ISO-8859-7?B?yv7z9OHyINDh8OHk/PDv9evv8g==?= , "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: , Message-ID: 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 =D4=E7 =CA=F5=F1=E9=E1=EA=DE, 27 =C9=E1=ED=EF=F5=E1=F1=DF=EF=F5 2013 8:36:4= 2 =EC.=EC. UTC+2, =EF =F7=F1=DE=F3=F4=E7=F2 Joel Goldstick =DD=E3=F1=E1=F8= =E5: > On Sun, Jan 27, 2013 at 1:05 PM, =CA=FE=F3=F4=E1=F2 =D0=E1=F0=E1=E4=FC=F0= =EF=F5=EB=EF=F2 wrote: >=20 > =D4=E7 =CA=F5=F1=E9=E1=EA=DE, 27 =C9=E1=ED=EF=F5=E1=F1=DF=EF=F5 2013 6:12= :59 =EC.=EC. UTC+2, =EF =F7=F1=DE=F3=F4=E7=F2 ru...@yahoo.com =DD=E3=F1=E1= =F8=E5: >=20 >=20 >=20 >=20 > > On 01/27/2013 02:04 AM, Ferrous Cranus wrote: >=20 > > >=20 > > >[...] >=20 > > >=20 > > > =A0 =A0 =A0 =A0 =A0 =A0 data =3D cur.fetchall() >=20 > > >=20 > > > =A0 =A0 =A0 =A0 =A0 =A0 for row in data: >=20 > > >=20 > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 print ( "" ) >=20 > > >=20 > > > >=20 > > >=20 > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 for item in row: >=20 > > >=20 > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 print( ''' =A0%s =A0''' % (item, item)= ) >=20 >=20 > > >=20 > > >[...] >=20 > > >=20 > > > Okey, so far BUT i want the url linking to happen only for the URL co= lumn's >=20 > > >=20 > > > value, and not for the hits column too. How do i apply the url link t= o the >=20 > > >=20 > > > URL column's value only? >=20 > > >=20 > > >=20 > > >=20 > > Ferrous, >=20 > > >=20 > > >=20 > > >=20 > > 'row' has two items (the url and the hit count) in it, right? >=20 > > >=20 > > So print each separately rather than in a loop: >=20 > > >=20 > > >=20 > > >=20 > > =A0 =A0 data =3D cur.fetchall() >=20 > > >=20 > > =A0 =A0 for row in data: >=20 > > >=20 > > =A0 =A0 =A0 url =3D row[0] >=20 > > >=20 > > =A0 =A0 =A0 hits =3D row[1] >=20 > > >=20 > > =A0 =A0 =A0 =A0 print ( "" ) >=20 > > >=20 > > =A0 =A0 =A0 =A0 print( " =A0%s= =A0: % (url, hits) ) >=20 >=20 >=20 > Yes that can work, but i want to ask you if its possible to do the same t= hing from within the loop as i have it coded it until now. >=20 >=20 >=20 > Is there a way to seperate the values within the loop? >=20 >=20 >=20 > for row in data: >=20 > =A0 =A0 print( " =A0%s =A0: " % (row[0], row[1]) ) This is not correct. the attribute is for url (row[0]) only, not for url and hits too. i want the following working code: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D data =3D cur.fetchall() for row in data: url =3D row[0] hits =3D row[1] print ( "" ) print( " %s " % (url= , url) ) print( " %s " % (hits) ) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D inside the loop i posted initially, if its possible.