realtime output and csv files

Bernardo Sulzbach mafagafogigante at gmail.com
Fri Feb 5 16:51:19 EST 2016


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 1,10:24,20.4 is 
*safer* and - to my eyes - better CSV.

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".



More information about the Python-list mailing list