Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #41778
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <jiewei24@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.036 |
| X-Spam-Evidence | '*H*': 0.93; '*S*': 0.00; 'output': 0.04; 'brackets': 0.09; 'rows': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr :python-list': 0.10; 'slightly': 0.15; '24,': 0.16; 'csv': 0.16; 'row': 0.16; 'silly': 0.16; 'subject:reader': 0.16; 'typo': 0.16; 'with?': 0.16; 'wrote:': 0.17; 'specify': 0.17; 'question.': 0.20; 'all,': 0.21; 'import': 0.21; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'tried': 0.25; 'least': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'am,': 0.27; 'correct': 0.28; 'file': 0.32; 'print': 0.32; 'consist': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'there': 0.35; 'explain': 0.36; 'but': 0.36; 'wanted': 0.36; 'guidance': 0.36; 'display': 0.36; 'one,': 0.37; 'subject:: ': 0.38; 'address': 0.60; 'john': 0.60; 'places': 0.61; 'different': 0.63; 'information': 0.63; 'show': 0.63; 'telephone': 0.64; 'here': 0.65; 'differences': 0.65; 'power': 0.74; 'square': 0.75; '2013': 0.84; 'text-based': 0.84; 'birthday': 0.91; 'angel': 0.93; 'ministry': 0.93 |
| X-Received | by 10.50.135.10 with SMTP id po10mr1926201igb.4.1364112719165; Sun, 24 Mar 2013 01:11:59 -0700 (PDT) |
| Newsgroups | comp.lang.python |
| Date | Sun, 24 Mar 2013 01:11:58 -0700 (PDT) |
| In-Reply-To | <mailman.3662.1364104023.2939.python-list@python.org> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=202.171.164.211; posting-account=Ku_GgAoAAACcsiNwXg5lFaSDSrqhcidb |
| References | <fdcdb6d8-c63a-4909-8b56-13204a0d474c@googlegroups.com> <mailman.3662.1364104023.2939.python-list@python.org> |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| X-Google-IP | 202.171.164.211 |
| MIME-Version | 1.0 |
| Subject | Re: Separate Rows in reader |
| From | Jiewei Huang <jiewei24@gmail.com> |
| To | comp.lang.python@googlegroups.com |
| Content-Type | text/plain; charset=ISO-8859-1 |
| 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 <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.3665.1364127021.2939.python-list@python.org> (permalink) |
| Lines | 108 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1364127021 news.xs4all.nl 6937 [2001:888:2000:d::a6]:39319 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:41778 |
Show key headers only | View raw
On Sunday, March 24, 2013 3:46:49 PM UTC+10, Dave Angel wrote:
> On 03/24/2013 01:20 AM, Jiewei Huang wrote:
>
> > Hi all,
>
> >
>
> > Currently create a simple text-based database of information about people
>
> >
>
> >
>
> > I have a csv file which consist of 3 rows , row 1 2 and 3 is as such:
>
> > Name Address Telephone Birthday
>
> > John Konon Ministry of Moon Walks 4567882 27-Feb
>
> > Stacy Kisha Ministry of Man Power 1234567 17-Jan
>
> >
>
> >
>
> > My codes are :
>
> > import csv
>
> > original = file('friends.csv', 'rU')
>
> > reader = csv.reader(original)
>
> >
>
> > for row in reader:
>
> >
>
> > print row
>
> >
>
> >
>
> > and the output is :
>
> > ['Name', ' Address', 'Telephone', 'Birthday']
>
> > ['John Konon', 'Ministry of Moon Walks', '4567882', '27-Feb']
>
> > ['Stacy Kisha', 'Ministry of Man Power', '1234567', '17-Jan']
>
> >
>
> > But i wanted to make it
>
> >
>
> > [('John Cleese', 'Ministry of Silly Walks', '5555421', '27-Feb'),
>
> > ( 'Stacy Kisha', 'Ministry of Man Power', '1234567', 17-Jan')]
>
> >
>
> > can someone show me guidance to this issue
>
> >
>
> > Thanks all
>
> >
>
>
>
> There are at least 3 differences to the printouts. Which difference are
>
> you concerned with?
>
>
>
> 1) Moon --> Silly
>
> 2) square and round brackets in slightly different places
>
> 3) row 0 suppressed
>
>
>
> Explain which one, or specify a fourth, and also what you have tried to
>
> address the question.
>
>
>
>
>
> --
>
> DaveA
Sorry my typo in the output here is the correct output that i need :
[('John Konon', 'Ministry of moon Walks', '4567882', '27-Feb'),
( 'Stacy Kisha', 'Ministry of Man Power', '1234567', 17-Jan')]
the difference is that i need a [(row two), (row three), (row fouth)] . I do not want to display row one which is ['Name', ' Address', 'Telephone', 'Birthday']
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Separate Rows in reader Jiewei Huang <jiewei24@gmail.com> - 2013-03-23 22:20 -0700
Re: Separate Rows in reader Dave Angel <davea@davea.name> - 2013-03-24 01:46 -0400
Re: Separate Rows in reader rusi <rustompmody@gmail.com> - 2013-03-24 00:34 -0700
Re: Separate Rows in reader Jiewei Huang <jiewei24@gmail.com> - 2013-03-24 01:18 -0700
Re: Separate Rows in reader Jiewei Huang <jiewei24@gmail.com> - 2013-03-24 01:11 -0700
Re: Separate Rows in reader Dave Angel <davea@davea.name> - 2013-03-24 09:03 -0400
Re: Separate Rows in reader Tim Chase <python.list@tim.thechases.com> - 2013-03-24 08:49 -0500
Re: Separate Rows in reader rusi <rustompmody@gmail.com> - 2013-03-24 08:57 -0700
Re: Separate Rows in reader Tim Chase <python.list@tim.thechases.com> - 2013-03-24 13:28 -0500
Re: Separate Rows in reader rusi <rustompmody@gmail.com> - 2013-03-24 19:08 -0700
Re: Separate Rows in reader Jiewei Huang <jiewei24@gmail.com> - 2013-03-24 01:11 -0700
Re: Separate Rows in reader ypsun <winter0128@gmail.com> - 2013-03-24 03:58 -0700
Re: Separate Rows in reader ypsun <winter0128@gmail.com> - 2013-03-24 04:10 -0700
Re: Separate Rows in reader Jiewei Huang <jiewei24@gmail.com> - 2013-03-24 23:52 -0700
Re: Separate Rows in reader rusi <rustompmody@gmail.com> - 2013-03-25 06:51 -0700
Re: Separate Rows in reader Jiewei Huang <jiewei24@gmail.com> - 2013-03-25 18:05 -0700
Re: Separate Rows in reader Dave Angel <davea@davea.name> - 2013-03-25 21:40 -0400
Re: Separate Rows in reader Jiewei Huang <jiewei24@gmail.com> - 2013-03-25 20:33 -0700
Re: Separate Rows in reader MRAB <python@mrabarnett.plus.com> - 2013-03-26 03:48 +0000
Re: Separate Rows in reader Jiewei Huang <jiewei24@gmail.com> - 2013-03-26 00:24 -0700
Re: Separate Rows in reader Jiewei Huang <jiewei24@gmail.com> - 2013-03-26 00:24 -0700
Re: Separate Rows in reader Jiewei Huang <jiewei24@gmail.com> - 2013-03-27 02:35 -0700
Re: Separate Rows in reader rusi <rustompmody@gmail.com> - 2013-03-27 04:18 -0700
Re: Separate Rows in reader Jiewei Huang <jiewei24@gmail.com> - 2013-03-27 15:12 -0700
Re: Separate Rows in reader Jiewei Huang <jiewei24@gmail.com> - 2013-03-27 15:26 -0700
Re: Separate Rows in reader rusi <rustompmody@gmail.com> - 2013-03-27 18:24 -0700
Re: Separate Rows in reader Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-28 01:32 +0000
Re: Separate Rows in reader Jiewei Huang <jiewei24@gmail.com> - 2013-03-27 02:35 -0700
Re: Separate Rows in reader Tim Roberts <timr@probo.com> - 2013-03-28 21:28 -0700
Re: Separate Rows in reader Jiewei Huang <jiewei24@gmail.com> - 2013-03-25 20:33 -0700
Re: Separate Rows in reader Jiewei Huang <jiewei24@gmail.com> - 2013-03-24 18:15 -0700
csiph-web