Re: realtime output and csv files

2016-02-06 Thread Tim Chase
On 2016-02-06 02:53, Bernardo Sulzbach wrote: >> And even if you have things to escape or format correctly, the >> stdlib has a "csv" module that makes this trivially easy: >> > > I supposed it had one. Obviously, I've never used it myself, > otherwise I would be sure about its existence. Nice

Re: realtime output and csv files

2016-02-06 Thread lucan
I wouldn't be surprised if a parser treated a value as text only because it has spaces on it. For OP, if you are going for this, I - personally - suggest sticking to "%d,%2d:%2d,%.1f". you're rightin fact importing datas in spreadsheet I've had some problems. I'll follow this suggestion.

Re: realtime output and csv files

2016-02-05 Thread Joel Goldstick
On Fri, Feb 5, 2016 at 4:13 PM, Bernardo Sulzbach 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)

Re: realtime output and csv files

2016-02-05 Thread Bernardo Sulzbach
On 02/05/2016 07:43 PM, Joel Goldstick wrote: print("%d, %2d:%2d, %.1f" % (1,10,24,20.4)) 1, 10:24, 20.4 Let us be more careful there. Although CSV has no formal specification (according to the IETF), *those spaces are not good*. It is **very unlikely** that they will cause issues, but

Re: realtime output and csv files

2016-02-05 Thread Joel Goldstick
On Fri, Feb 5, 2016 at 4:51 PM, Bernardo Sulzbach wrote: > On 02/05/2016 07:43 PM, Joel Goldstick wrote: > >> print("%d, %2d:%2d, %.1f" % (1,10,24,20.4)) > 1, 10:24, 20.4 >> > > Let us be more careful there. Although CSV has no formal specification >

Re: realtime output and csv files

2016-02-05 Thread lucan
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))

realtime output and csv files

2016-02-05 Thread lucan
I'm new of python adn I'm using it only to complete some experiments. I'm reading a series of data from various sensors and in the meantime I'm writing datas on a file. I would like to print output in realtime (or refresh it when I need) but the problem is that I'm writing on a file every x

Re: realtime output and csv files

2016-02-05 Thread Bernardo Sulzbach
On 02/05/2016 05:49 PM, lucan wrote: Anyway from the moment that datas are scientific value is it correct to write on a file using str(temp) and separating with ","? I need a csv file to read it with some data analysis softwares. What do you mean? What is "datas"? What do you mean by

Re: realtime output and csv files

2016-02-05 Thread Bernardo Sulzbach
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

Re: realtime output and csv files

2016-02-05 Thread Bernardo Sulzbach
On Sat, Feb 6, 2016 at 2:27 AM, Tim Chase wrote: > 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

Re: realtime output and csv files

2016-02-05 Thread Tim Chase
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

Output to csv

2007-07-25 Thread Doran, Harold
informaiton, and spit out a file that can be opened in Excel in order to create tables for some reports we need. To accomplish this, I enter in commas by brute force so that the output is a csv file that excel can open. This program works fine, but, as I am still learning python, I am interested