Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #102562
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Joel Goldstick <joel.goldstick@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: realtime output and csv files |
| Date | Fri, 5 Feb 2016 16:43:15 -0500 |
| Lines | 50 |
| Message-ID | <mailman.22.1454708599.2317.python-list@python.org> (permalink) |
| References | <n92ucb$1h5s$1@gioia.aioe.org> <mailman.13.1454702263.2317.python-list@python.org> <n9331n$1omq$1@gioia.aioe.org> <56B51065.2090104@gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de 01BVF4QGPCTRBZkvICobSwMnUMMC+81510poFHI0l73A== |
| Return-Path | <joel.goldstick@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'received:209.85.223': 0.03; 'method.': 0.05; '(so': 0.07; 'formatting': 0.07; 'cc:addr :python-list': 0.09; '"my': 0.09; 'csv': 0.09; 'skip:f 70': 0.09; 'subject:files': 0.09; 'python': 0.10; 'index': 0.13; '>>>': 0.15; 'headers': 0.15; '2016': 0.16; 'newlines': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'temp': 0.16; 'wrote:': 0.16; 'email addr:gmail.com>': 0.18; '>>>': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'file:': 0.22; 'feb': 0.23; 'this:': 0.23; 'header:In-Reply-To:1': 0.24; 'example': 0.26; 'fri,': 0.27; 'wonder': 0.27; 'message-id:@mail.gmail.com': 0.27; 'correct': 0.28; 'values': 0.28; 'that.': 0.30; 'url:mailman': 0.30; 'url:python': 0.33; 'url:listinfo': 0.34; 'skip:& 20': 0.35; 'received:google.com': 0.35; 'newer': 0.35; 'should': 0.36; 'there': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'skip:& 10': 0.37; 'received:209': 0.38; 'mean': 0.38; 'url:mail': 0.40; 'your': 0.60; 'bernardo': 0.84; 'temperature': 0.84; 'to:none': 0.91; 'joel': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=27Qk1z8R358iZuoTfLMlIoooVPIx5u0jwFf6xNoXMtM=; b=AYWkMtTAU4o7A3zjQlFMA65UVFp4a6YbKHSzZHTK38w0NGoQRCF8yMt7coWPWkSqkL FA9Kh7SQ1tXjGDXPBvld1gjj81+xPBD7C2qR9C2tGcPMIYNAuGMCy+Od94xNBsYBqASD RRMJXBEGtlJYIeS0Um6r2pDLk4gL2cLaykmta/kOJ4nsinPyYJvexmJqlbvjol/qkz8f 5rnR3iiBkab9ECX4AYdSqgcixpNLgHs7vCATgS6npq4aSsUycYExZ2p7KRjuGkeSkfta blW5M8Qw727xppTOafcXyqMLzVkF/vpqqkKsaRBblH39ZoyuCKSd7zCgcnO8g7fowVou Kylg== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc:content-type; bh=27Qk1z8R358iZuoTfLMlIoooVPIx5u0jwFf6xNoXMtM=; b=eNQTI5YvmIU3HXJE6UTzUrWMaOaiQ/ip+M7VMReZO+6OgmlEa2F2rdEP5kDzdP9KiZ peHLkPerBpGXi+72cDBoSdNC3PpfsOkscWwE2gF7EDUOkEL0o2NUQUvaV5QpH4qC5f3+ GlM99FHivnfNl9OJbwcu/WwezZZjbnVNbjUgJK3Z7HepDHtqxyBcMlKRSq4dzwg/pD/L DSB0igMa0JBac83JjJ02JVq5Bn1y8kx+sUL7mSo7GbwZhX7OSdcNCupmWMywJkOsXHEZ QiTTOzK+jkXk8aCcRqjtUQjqJYLttrWTgPlF64zeh7VrVIwiIQI/u66di+jGix03UkY9 8V/Q== |
| X-Gm-Message-State | AG10YOT4rdBWsWbPrLUNBJc35alyM60G7kZhRbKH1dnJmrF9iwPaDEAirxsa5MZvrbdqzVTROPrKisu/lE/2YQ== |
| X-Received | by 10.107.62.5 with SMTP id l5mr17373618ioa.180.1454708595569; Fri, 05 Feb 2016 13:43:15 -0800 (PST) |
| In-Reply-To | <56B51065.2090104@gmail.com> |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.21rc2 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.21rc2 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Xref | csiph.com comp.lang.python:102562 |
Show key headers only | View raw
On Fri, Feb 5, 2016 at 4:13 PM, Bernardo Sulzbach <mafagafogigante@gmail.com
> wrote:
> 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))
>>
>
You might want to do this:
f.write("%d, %2d:%2d, %.1f" % (index, now.hour, now.minute, temp))
In my test:
>>> print("%d, %2d:%2d, %.1f" % (1,10,24,20.4))
1, 10:24, 20.4
This uses the original python formatting method. There is a newer one as
well
>
>> 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.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
Joel Goldstick
http://joelgoldstick.com/stats/birthdays
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
realtime output and csv files lucan <lucan@NNN.it> - 2016-02-05 20:49 +0100
Re: realtime output and csv files Bernardo Sulzbach <mafagafogigante@gmail.com> - 2016-02-05 17:57 -0200
Re: realtime output and csv files lucan <lucan@NNN.it> - 2016-02-05 22:09 +0100
Re: realtime output and csv files Bernardo Sulzbach <mafagafogigante@gmail.com> - 2016-02-05 19:13 -0200
Re: realtime output and csv files Joel Goldstick <joel.goldstick@gmail.com> - 2016-02-05 16:43 -0500
Re: realtime output and csv files Bernardo Sulzbach <mafagafogigante@gmail.com> - 2016-02-05 19:51 -0200
Re: realtime output and csv files lucan <lucan@NNN.it> - 2016-02-06 14:40 +0100
Re: realtime output and csv files Joel Goldstick <joel.goldstick@gmail.com> - 2016-02-05 17:12 -0500
Re: realtime output and csv files Tim Chase <python.list@tim.thechases.com> - 2016-02-05 22:27 -0600
Re: realtime output and csv files Bernardo Sulzbach <mafagafogigante@gmail.com> - 2016-02-06 02:53 -0200
Re: realtime output and csv files Tim Chase <python.list@tim.thechases.com> - 2016-02-06 06:45 -0600
csiph-web