[python-win32] writing hyphenated values in csv
Dahlstrom, Roger
rdahlstrom at directedge.com
Tue May 26 12:45:28 CEST 2009
Additionally, your csv file is *not* being auto-corrected. If this file is supposed to be able to be imported into things *other* than Excel, leave it alone and do not put an equals in front of it. If you were to open your file in Notepad or some other text editor, you'd see the value as you expect it.
-----Original Message-----
From: python-win32-bounces+rdahlstrom=directedge.com at python.org [mailto:python-win32-bounces+rdahlstrom=directedge.com at python.org] On Behalf Of Tim Roberts
Sent: Friday, May 22, 2009 8:58 PM
To: Python-Win32 List
Subject: Re: [python-win32] writing hyphenated values in csv
Emad Khan wrote:
>
> I am trying to write a hyphenated value in a csv file but I don't want
> this value to be auto corrected to a date. Whenever I write a value,
> for example, "3-10", it is changed to 03/10/2009 or 03-oct.
>
> How can I prevent this from happening. I would like to see the value
> remain to be "3-10".
You should be more specific. I, for example, understand that it is
Excel that is doing this, but you need to mention that. It's not really
a CSV or Python problem at all -- it's an Excel problem.
The answer, in this case, is to put an equals sign in front of the
quoted value. Thus this file:
123,3-10,"3-10",=3-10,="3-10"
gets imported as
123 10-Mar 10-Mar -7 3-10
Again, however, this is just an Excel quirk. If you need to import into
Excel a lot, you might consider switching to Excel's XML format. You
have a great deal more control in that case.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
_______________________________________________
python-win32 mailing list
python-win32 at python.org
http://mail.python.org/mailman/listinfo/python-win32
DISCLAIMER:
This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and
may contain legally privileged and/or confidential information. If you are not the intended recipient
of this e-mail, you are hereby notified that any dissemination, distribution or copying of this e-mail, and
any attachments thereto, is strictly prohibited. If you have received this in error, please immediately notify
me and permanently delete the original and any copy of any e-mail and any printout thereof.
E-mail transmission cannot be guaranteed to be secure or error-free. The sender therefore does not accept
liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission.
NOTICE REGARDING PRIVACY AND CONFIDENTIALITY
Direct Edge ECN LLC may, at its discretion, monitor and review the content of all e-mail communications.
www.directedge.com
More information about the python-win32
mailing list