Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Bernardo Sulzbach Newsgroups: comp.lang.python Subject: Re: realtime output and csv files Date: Fri, 5 Feb 2016 19:13:09 -0200 Lines: 22 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de R9MUPhVYjRwvZStxua00mQO8mfAmA49jjSXUjVJe2izQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; '(so': 0.07; '"my': 0.09; 'csv': 0.09; 'skip:f 70': 0.09; 'subject:files': 0.09; 'index': 0.13; 'headers': 0.15; 'newlines': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'temp': 0.16; 'wrote:': 0.16; 'file:': 0.22; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'example': 0.26; 'wonder': 0.27; 'correct': 0.28; 'values': 0.28; 'that.': 0.30; 'message-id:@gmail.com': 0.34; 'received:google.com': 0.35; 'should': 0.36; 'there': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:localhost.localdomain': 0.38; 'received:209': 0.38; 'received:localdomain': 0.38; 'mean': 0.38; 'received:209.85.220': 0.38; 'to:addr:python.org': 0.40; 'your': 0.60; 'charset:windows-1252': 0.62; 'temperature': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=h+usXGt+22AhIul0Ys+AMCkhGlgv+GhW4mjboNNcTRA=; b=XXgNcpg1/4bATLbr8QCwL91zrRC5mljXhpdoy+nGoPeRA3F+/t5LnJpgsGpVY3yXmS q9wxFfOmMEGWtghanVS1B3nhka+T/lb92cAwOC7hUVHG+z+8XnPSmlCVcMYEamu0CXVp LPDQGb6sLAGMr/A2c46kXEFmquRIzIhsNcaQ6SkIeQlPcG6vKoQLvhRgXlKJJEWry2KG Tm0HswFoUvqyxTD5juJFqbSbiVvyAudjsnHz7ZheGeOztUzQv3Vuj1pOsdJ2y8b85sCh 1tb2Fs88CGBjHGiobbm7H/OiontoXtVm80BVjXdnfzH0dRJLc20AHDQNKxH6FDzTD85i Ur6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=h+usXGt+22AhIul0Ys+AMCkhGlgv+GhW4mjboNNcTRA=; b=k/Xo4wiSzz2CvOcJaGcwLVqP8nE/NmP77Oh1Ke35njtcdAKRw/p3h8pYpaHs4KP+kv Vfa3q8cLPdv3h+Z86TQCCjMVpSTbZKVluO1nCSxEr8Oe18SAAXHQ6TJ3ZQS1NGa7YYTn ZUqaDKxjHQz1TipQyMl3L8MUodXrfDldHd+IO3l9AhVe666X96wdnCzpYMhWbtm+GF2t 56//IW5MkBfc7pF5cYTzjl3n6qbpjxXmh+Db/0BhpcfZcjfIFzUkE6u6vjHyBPfHAsK3 OP+P7pi9Hk20o11SMtYjJ/V2A1I8xFcOfHPM2UUI2LbfEU/XHxy+PS824VMEA3sWHuAT K6aw== X-Gm-Message-State: AG10YOT1gG9KkdmpsUZz+SUrObkjdxGCjtOpQThy+Q/USsUSb6aoptFw2LyakD0ZbUxoRw== X-Received: by 10.55.78.207 with SMTP id c198mr19064210qkb.34.1454706793885; Fri, 05 Feb 2016 13:13:13 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 In-Reply-To: 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:102559 On 02/05/2016 07:09 PM, lucan wrote: > >> What do you mean? What is "datas"? What do you mean by "correct"? > > "datas" I mean the values for example temperature = 20.4 (so they are > floating point) > > Index time temp > 1 10:24 20.4 > 2 10:25 20.6 > ... > > I wonder if this is correct "my way" to write a csv file: > > file.write('\n'+str(index)) > f.write(str(index)+','+str(now.hour)+':'+str(now.minute)+','+str(temp)) > > Or if there is a better way to do that. > If you got your newlines and headers (if the other program requires it) right, this should be all you need.