= OS: XP
= Python v. 2.5
I'm fairly new to all this, so be gentle... ;-)
I've written a small script which strips values from a form and writes them to a CSV (excel-tab). Some of the data I expect to import is in the form of large numbers, which Excel habitually displays as Scientific Notation (not very helpful!)
This works, but all the data is prepacked in single quotes. Not elegant.
I tried
but Excel doesn't appear to recognise the explicit string conversion. Am I missing something?
The ideal solution would be if users could switch off Scientific Notation display behaviour as a default when starting Excel. (I've looked, but can't see where to do this.)
The next-best thing would be if there were a CSV dialect (excel-nosci) which does the appropriate thing. I don't thing setting QUOTING = ALL *is* appropriate, but I'm willing to be persuaded!
Any help would be warmly welcomed
Simon
= Python v. 2.5
I'm fairly new to all this, so be gentle... ;-)
I've written a small script which strips values from a form and writes them to a CSV (excel-tab). Some of the data I expect to import is in the form of large numbers, which Excel habitually displays as Scientific Notation (not very helpful!)
Code:
linessplit=[s1.split(':',1) for s1 in lines] # Form Labels end with ':' if(some_condition): logfile.write(today) logfile.write('\t') splitvalues=["'"+x[1].strip() for x in linessplit] logfile.write('\t'.join(["%s" % (v,) for v in splitvalues]))
I tried
Code:
splitvalues=[str(x[1].strip()) for x in linessplit]
The ideal solution would be if users could switch off Scientific Notation display behaviour as a default when starting Excel. (I've looked, but can't see where to do this.)
The next-best thing would be if there were a CSV dialect (excel-nosci) which does the appropriate thing. I don't thing setting QUOTING = ALL *is* appropriate, but I'm willing to be persuaded!
Any help would be warmly welcomed
Simon
Comment