Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.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.081 X-Spam-Evidence: '*H*': 0.84; '*S*': 0.00; 'output': 0.04; 'brackets': 0.09; 'rows': 0.09; 'slightly': 0.15; 'csv': 0.16; 'row': 0.16; 'silly': 0.16; 'subject:reader': 0.16; 'with?': 0.16; 'wrote:': 0.17; 'specify': 0.17; 'question.': 0.20; 'all,': 0.21; 'import': 0.21; 'tried': 0.25; 'least': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'file': 0.32; 'print': 0.32; 'consist': 0.33; 'to:addr:python-list': 0.33; 'thanks': 0.34; 'there': 0.35; 'explain': 0.36; 'but': 0.36; 'wanted': 0.36; 'guidance': 0.36; 'one,': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'address': 0.60; 'john': 0.60; 'places': 0.61; 'different': 0.63; 'information': 0.63; 'show': 0.63; 'telephone': 0.64; 'differences': 0.65; 'received:74.208': 0.71; 'power': 0.74; 'square': 0.75; 'text-based': 0.84; 'birthday': 0.91; 'ministry': 0.93 Date: Sun, 24 Mar 2013 01:46:49 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Separate Rows in reader References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:N/1LdjuNhP/KYDoGTYzgAaipc0+h3pE9zzUIATdl4E0 ILKGb/jN4GwYlCDmqV6bRF1EmEDbA6fk/qnh26+Fw3awnd4MAO jK0hOQUItoSl4zn0e9Hdnv9novxY85OWUBP8SLGzh1Wqepw/jT onZGdt2JLMWGsc5I6QWQOXN2cBYBIfF5q7/Sc0Wtb6OFSrHV7/ wTJmOPWYMwL/6Xu8gBM5SxAQt9LxYmuwCU5J2HjH7p4mhJ4/HI D0KmxRM88Ky7UnKDaQWTzks8buE4Ve7AUSvL8V/XTjj5ReKY1q JTeKqtSaCq1PYPB9oibrb2VjmThBGX1N89TgLAxIe1fKA9bSg= = 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: 50 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1364104023 news.xs4all.nl 6883 [2001:888:2000:d::a6]:58156 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:41768 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