X-Received: by 10.224.172.134 with SMTP id l6mr4070543qaz.7.1364113120086; Sun, 24 Mar 2013 01:18:40 -0700 (PDT) X-Received: by 10.50.109.228 with SMTP id hv4mr669019igb.2.1364113119881; Sun, 24 Mar 2013 01:18:39 -0700 (PDT) Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!ca1no4539278qab.0!news-out.google.com!k8ni11100qas.0!nntp.google.com!ca1no4539271qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.python Date: Sun, 24 Mar 2013 01:18:39 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=202.171.164.211; posting-account=Ku_GgAoAAACcsiNwXg5lFaSDSrqhcidb NNTP-Posting-Host: 202.171.164.211 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Separate Rows in reader From: Jiewei Huang Injection-Date: Sun, 24 Mar 2013 08:18:40 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Lines: 123 Xref: csiph.com comp.lang.python:41774 On Sunday, March 24, 2013 5:34:03 PM UTC+10, rusi wrote: > On Mar 24, 10:46=A0am, Dave Angel wrote: >=20 > > On 03/24/2013 01:20 AM, Jiewei Huang wrote: >=20 > > >=20 > > >=20 > > >=20 > >this is the data in csv file http://imgur.com/L4qUkGQ and this is the correct output that i need to get: [('John Konon', 'Ministry of moon Walks', '4567882', '27-Feb'),=20 ( 'Stacy Kisha', 'Ministry of Man Power', '1234567', 17-Jan')]=20 sorry for the confusion=20 >=20 > > >=20 > > >=20 > > >=20 > > >=20 > > >=20 > > > Hi all, >=20 > > >=20 > > > Currently create a simple text-based database of information about pe= ople >=20 > > >=20 > > > I have a csv file which consist of 3 rows , row 1 2 and 3 is as such: >=20 > > > Name =A0 =A0 =A0 =A0Address =A0 =A0 =A0 =A0Telephone =A0 =A0 =A0 Birt= hday >=20 > > > John Konon Ministry of Moon Walks =A04567882 27-Feb >=20 > > > Stacy Kisha =A0 =A0 =A0 =A0Ministry of Man Power =A0 1234567 17-Jan >=20 > > >=20 > > > My codes are : >=20 > > > import csv >=20 > > > original =3D file('friends.csv', 'rU') >=20 > > > reader =3D csv.reader(original) >=20 > > >=20 > > > for row in reader: >=20 > > >=20 > > > =A0 =A0 =A0print row >=20 > > >=20 > > > and the output is : >=20 > > > ['Name', ' Address', 'Telephone', 'Birthday'] >=20 > > > ['John Konon', 'Ministry of Moon Walks', '4567882', '27-Feb'] >=20 > > > ['Stacy Kisha', 'Ministry of Man Power', '1234567', '17-Jan'] >=20 > > >=20 > > > But i wanted to make it >=20 > > >=20 > > > [('John Cleese', 'Ministry of Silly Walks', '5555421', '27-Feb'), >=20 > > > ( 'Stacy Kisha', 'Ministry of Man Power', '1234567', 17-Jan')] >=20 > > >=20 > > > can someone show me guidance to this issue >=20 > > >=20 > > > Thanks all >=20 > > >=20 > > There are at least 3 differences to the printouts. =A0Which difference = are >=20 > > you concerned with? >=20 > > >=20 > > 1) Moon --> Silly >=20 > > 2) square and round brackets in slightly different places >=20 > > 3) row 0 suppressed >=20 > > >=20 > > Explain which one, or specify a fourth, and also what you have tried to >=20 > > address the question. >=20 > > >=20 > > -- >=20 > > DaveA >=20 >=20 >=20 > Besides does it work as you are describing? >=20 > ie your input appears to be tab delimited, whereas the default is ','