Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Tim Chase Newsgroups: comp.lang.python Subject: Re: realtime output and csv files Date: Fri, 5 Feb 2016 22:27:15 -0600 Lines: 21 Message-ID: References: <56B4FEAC.4080706@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1HWkeeRVFfOVxNh6tdE6vwONp6nVXQTaEU5qKjwbEK4w== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'essentially': 0.04; 'data:': 0.07; 'escape': 0.07; 'formatting': 0.07; '(1,': 0.09; 'csv': 0.09; 'separating': 0.09; 'subject:files': 0.09; '(2,': 0.16; '-tkc': 0.16; 'commas,': 0.16; 'correctly,': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'row': 0.16; 'trivially': 0.16; 'writer': 0.16; 'wrote:': 0.16; 'library': 0.20; 'correctly.': 0.22; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'module': 0.25; 'separated': 0.29; 'url:mailman': 0.30; 'url:python': 0.33; 'url:listinfo': 0.34; 'text': 0.35; 'should': 0.36; 'url:org': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'charset:us-ascii': 0.37; 'things': 0.38; 'data': 0.39; 'format': 0.39; 'url:mail': 0.40; 'to:addr:python.org': 0.40; '"just': 0.84; 'bernardo': 0.84; 'received:10.235': 0.84; 'received:23': 0.84 X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-MC-Relay: Neutral X-MailChannels-SenderId: wwwh|x-authuser|tim@thechases.com X-MailChannels-Auth-Id: wwwh X-MC-Loop-Signature: 1454732992175:3946250180 X-MC-Ingress-Time: 1454732992175 In-Reply-To: <56B4FEAC.4080706@gmail.com> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) X-AuthUser: tim@thechases.com X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21rc2 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:102571 On 2016-02-05 17:57, Bernardo Sulzbach wrote: > CSVs is essentially text separated by commas, so you likely do not > need any library to write it "Just separating with ','" should work > if you are formatting them correctly. > https://mail.python.org/mailman/listinfo/python-list And even if you have things to escape or format correctly, the stdlib has a "csv" module that makes this trivially easy: data = [ (1, 3.14, "hello"), (2, 1.41, "goodbye"), ] from csv import writer with open("out.csv", "wb") as f: w = writer(f) w.writerows(data) # for row in data: # w.writerow(data) -tkc