Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #4019
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <philip@semanchuk.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.022 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; 'sqlite': 0.07; 'to:name:python list': 0.09; 'pm,': 0.11; '25,': 0.12; 'wrote:': 0.14; 'pythonic': 0.16; 'received:mindspring.com': 0.16; 'row': 0.16; 'subject:list': 0.22; 'header:In-Reply-To:1': 0.22; 'loop': 0.22; 'query': 0.29; 'list': 0.30; 'to:addr:python-list': 0.32; 'charset:us-ascii': 0.36; 'apr': 0.38; 'returning': 0.39; 'to:addr:python.org': 0.39; 'header:Mime-Version:1': 0.39; 'received:24': 0.39; 'works': 0.40; 'philip': 0.60; 'header :Message-Id:1': 0.62; 'received:69.73': 0.84 |
| Content-Type | text/plain; charset=us-ascii |
| Mime-Version | 1.0 (Apple Message framework v1084) |
| Subject | Re: De-tupleizing a list |
| From | Philip Semanchuk <philip@semanchuk.com> |
| In-Reply-To | <8dcab23b-6e38-41d0-9591-ef3cbfdbd589@a21g2000prj.googlegroups.com> |
| Date | Mon, 25 Apr 2011 23:38:11 -0400 |
| Content-Transfer-Encoding | 7bit |
| References | <8dcab23b-6e38-41d0-9591-ef3cbfdbd589@a21g2000prj.googlegroups.com> |
| To | Python list <python-list@python.org> |
| X-Mailer | Apple Mail (2.1084) |
| X-AntiAbuse | This header was added to track abuse, please include it with any abuse report |
| X-AntiAbuse | Primary Hostname - deimos.nocdirect.com |
| X-AntiAbuse | Original Domain - python.org |
| X-AntiAbuse | Originator/Caller UID/GID - [47 12] / [47 12] |
| X-AntiAbuse | Sender Address Domain - semanchuk.com |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| 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> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.826.1303790578.9059.python-list@python.org> (permalink) |
| Lines | 21 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1303790578 news.xs4all.nl 65870 [::ffff:82.94.164.166]:34826 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:4019 |
Show key headers only | View raw
On Apr 25, 2011, at 11:28 PM, Gnarlodious wrote:
> I have an SQLite query that returns a list of tuples:
>
> [('0A',), ('1B',), ('2C',), ('3D',),...
>
> What is the most Pythonic way to loop through the list returning a
> list like this?:
>
> ['0A', '1B', '2C', '3D',...
This works for me -
result = [('0A',), ('1B',), ('2C',), ('3D',), ]
result = [row[0] for row in result]
Cheers
Philip
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar
De-tupleizing a list Gnarlodious <gnarlodious@gmail.com> - 2011-04-25 20:28 -0700
Re: De-tupleizing a list CM <cmpython@gmail.com> - 2011-04-25 20:42 -0700
Re: De-tupleizing a list Gnarlodious <gnarlodious@gmail.com> - 2011-04-25 20:52 -0700
Re: De-tupleizing a list "Littlefield, Tyler" <tyler@tysdomain.com> - 2011-04-25 21:38 -0600
Re: De-tupleizing a list Philip Semanchuk <philip@semanchuk.com> - 2011-04-25 23:38 -0400
Re: De-tupleizing a list Paul Rubin <no.email@nospam.invalid> - 2011-04-25 21:08 -0700
Re: De-tupleizing a list John Connor <john.theman.connor@gmail.com> - 2011-04-25 23:29 -0500
Re: De-tupleizing a list Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-04-26 04:59 +0000
Re: De-tupleizing a list rusi <rustompmody@gmail.com> - 2011-04-25 22:26 -0700
Re: De-tupleizing a list Gnarlodious <gnarlodious@gmail.com> - 2011-04-26 05:19 -0700
Re: De-tupleizing a list Algis Kabaila <akabaila@pcug.org.au> - 2011-04-27 04:30 +1000
Re: De-tupleizing a list Hans Georg Schaathun <hg@schaathun.net> - 2011-04-26 21:11 +0100
Re: De-tupleizing a list Ethan Furman <ethan@stoneleaf.us> - 2011-04-26 13:37 -0700
Re: De-tupleizing a list Hans Georg Schaathun <hg@schaathun.net> - 2011-04-26 21:58 +0100
Re: De-tupleizing a list Raymond Hettinger <python@rcn.com> - 2011-04-26 14:16 -0700
Re: De-tupleizing a list John Pinner <funthyme@gmail.com> - 2011-04-27 03:56 -0700
Re: De-tupleizing a list Algis Kabaila <akabaila@pcug.org.au> - 2011-04-28 05:31 +1000
csiph-web