From spikeharman at hotmail.com Sat Apr 3 12:14:12 2004 From: spikeharman at hotmail.com (Mike) Date: Sat, 3 Apr 2004 11:14:12 +0100 Subject: [Csv] PEP 305 Message-ID: Hi there, I was hoping you can help me.... I have a bf1942 clan website and i want to add stats of my members to the site using csv. files can you help or direct me to a website that can ???? e.mail me at meric at ta.150m.com :) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/csv/attachments/20040403/b20eb2ad/attachment.html From jeffbarish at starband.net Mon Apr 5 23:55:02 2004 From: jeffbarish at starband.net (Jeffrey Barish) Date: Mon, 5 Apr 2004 15:55:02 -0600 Subject: [Csv] CSV ignores lineterminator Message-ID: <200404051555.02652.jeffbarish@starband.net> A responder to my usenet posting suggested sending email to this address. With input_data = ['word1\tword2;word3\tword4;', 'word5\tword6;word7\tword8;'] and delimiter = '\t' lineterminator = ';' shouldn't csv.reader(input_data, dialect='mydialect') return ['word1', 'word2'] ['word3', 'word4'] ['word5', 'word6'] ['word7', 'word8'] I?find?that?it?doesn't?matter?how?I?set lineterminator, csv always terminates at the end of the line returned by the iterable object passed as its first argument (input_data, in this case): word1 word2;word3 word4 word5 word6;word7 word8 Also, if I use as input_data: ['word1\tword2;', 'word3\tword4', 'word5\tword6;', 'word7\tword8;'] I expect to get word1 word2 word3 word4word5 word6 word7 word8 In words, csv.reader() doesn't find a lineterminator when it reads the second "line" of the list so it reads another line where it does find a lineterminator. I get a line break after word4 even though no lineterminator appears there. I'm using Python 2.3 on Linux 2.4.23. -- Jeffrey Barish 970-728-1925 120 Aldasoro Rd Telluride, CO 81435 From andrewm at object-craft.com.au Tue Apr 6 01:35:28 2004 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Tue, 06 Apr 2004 09:35:28 +1000 Subject: [Csv] CSV ignores lineterminator In-Reply-To: Message from Jeffrey Barish <200404051555.02652.jeffbarish@starband.net> References: <200404051555.02652.jeffbarish@starband.net> Message-ID: <20040405233528.7B8253C1C9@coffee.object-craft.com.au> >With > > input_data = ['word1\tword2;word3\tword4;', > 'word5\tword6;word7\tword8;'] > > and > > delimiter = '\t' > lineterminator = ';' > > shouldn't csv.reader(input_data, dialect='mydialect') return > > ['word1', 'word2'] > ['word3', 'word4'] > ['word5', 'word6'] > ['word7', 'word8'] > > I find that it doesn't matter how I set lineterminator, csv always >terminates at the end of the line returned by the iterable object passed >as its first argument (input_data, in this case): > > word1 word2;word3 word4 > word5 word6;word7 word8 Yes - the lineterminator is only used for output. When the csv module was moved to 2.3, we chose to implement the iterator protocol for input so the module could accept input from any iterator-like object. Unfortunately, this also introduces the inconsistency you have noted. -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From andrewm at object-craft.com.au Tue Apr 6 03:49:27 2004 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Tue, 06 Apr 2004 11:49:27 +1000 Subject: [Csv] CSV ignores lineterminator In-Reply-To: Message from Jeffrey Barish <200404051917.51206.jeffbarish@starband.net> References: <200404051555.02652.jeffbarish@starband.net> <200404051753.52228.jeffbarish@starband.net> <20040405235857.852893C1C9@coffee.object-craft.com.au> <200404051917.51206.jeffbarish@starband.net> Message-ID: <20040406014927.7CB253C744@coffee.object-craft.com.au> >I understand the difficulty of these sorts of tradeoffs. My main wish is >that the documentation was clearer so that I could have avoided spending so >much time trying to understand what was going wrong. I'd agree with that. Part of the problem is time - this gets done in time we steal from other projects, and that's in short supply at the moment. Of course, if you're annoyed enough at the state of the doco, maybe you'd consider giving us a hand with them? Both the PEP and the python module doco could do with a thorough going over before Python 2.4 comes out. 8-) >Speaking of which -- and I don't intend to nag you indefinitely -- the >documentation says that the dialect argument to reader or writer takes a >string that identifies a dialect previously registered using >register_dialect. However, the email I got from Skip Montanaro passed a >dialect directly -- and that seems to work too. Is it permitted to use >either a string or a dialect? If I remember correctly, the underlying C module will accept either a dialect object, or keyword arguments describing a dialect (which, I think, it converts to a dialect object). I think you can actually mix dialect and keyword arguments to get an effect like "I want excel, but with these changes". That was the intention, anyway... 8-) -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From manian at dishnetdsl.net Tue Apr 6 13:34:00 2004 From: manian at dishnetdsl.net (Shiva Kumar) Date: Tue, 6 Apr 2004 17:04:00 +0530 Subject: [Csv] PEP 305 Message-ID: <000901c41bcb$10311660$0701a8c0@advaita> how to generate empty csv files plz send me ASAP regards shivkumar -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/csv/attachments/20040406/13086b65/attachment.htm From skip at pobox.com Tue Apr 6 16:33:00 2004 From: skip at pobox.com (Skip Montanaro) Date: Tue, 6 Apr 2004 09:33:00 -0500 Subject: [Csv] PEP 305 In-Reply-To: <000901c41bcb$10311660$0701a8c0@advaita> References: <000901c41bcb$10311660$0701a8c0@advaita> Message-ID: <16498.49052.313365.729753@montanaro.dyndns.org> Shiva> how to generate empty csv files plz An empty csv file would be either an empty file or a csv file with just a line identifying the field headers. For the former, just open and close a file: file("empty.csv", "wb") For the latter, just write the header row, e.g.: writer = csv.writer(file("empty.csv", "wb")) writer.writerow(("date", "city", "state", "performer", "venue")) del writer Skip From shiv_kumar_m at rediffmail.com Fri Apr 30 08:19:54 2004 From: shiv_kumar_m at rediffmail.com (shiv ku mar) Date: 30 Apr 2004 06:19:54 -0000 Subject: [Csv] None Message-ID: <20040430061954.18848.qmail@webmail10.rediffmail.com> An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/csv/attachments/20040430/b038d4fd/attachment.html -------------- next part -------------- ? hello sir, which is namespace for csv & xmlcsvreader &xmlcsvwriter,plz send me an details about the this ASAP,plz thanks regards shivakumar