Re: [Tutor] create an xls file using data from a txt file

2011-05-12 Thread Steve Willoughby
Maybe we're splitting hairs over semantics then. I thought there was confusion about what the CLI shell was doing with file separators as opposed to just handing the arguments as-is to the applications (which is true... the CLI doesn't really process them much, it's up to the application. Whe

Re: [Tutor] create an xls file using data from a txt file

2011-05-12 Thread Prasad, Ramit
, May 11, 2011 6:24 PM To: Prasad, Ramit; tutor@python.org Subject: Re: [Tutor] create an xls file using data from a txt file On 11-May-11 15:54, Prasad, Ramit wrote: >> Core windows commands don't generally accept it, including native >> Windows applications (although sometime

Re: [Tutor] create an xls file using data from a txt file

2011-05-12 Thread Tim Golden
To confirm: Python does *nothing* to convert automatically from one form of path separator to another. Windows from very early on, has accepted /-slashes as path separators to API calls. Where they don't work is: at the command shell itself presumably since slashes are commonly used to introduce o

Re: [Tutor] create an xls file using data from a txt file

2011-05-12 Thread Peter Otten
Steve Willoughby wrote: > On 11-May-11 15:54, Prasad, Ramit wrote: >>> Core windows commands don't generally accept it, including native >>> Windows applications (although sometimes they're lenient in what they >>> accept). It'll work for command-line Python script usage because it's >>> *python*

Re: [Tutor] create an xls file using data from a txt file

2011-05-11 Thread tee chwee liong
excellent it works. tq Date: Wed, 11 May 2011 14:58:39 +0100 Subject: Re: [Tutor] create an xls file using data from a txt file From: wpr...@gmail.com To: tc...@hotmail.com CC: taxbot...@gmail.com; tutor@python.org On 11 May 2011 14:34, tee chwee liong wrote: hi all, thanks for this

Re: [Tutor] create an xls file using data from a txt file

2011-05-11 Thread Steve Willoughby
On 11-May-11 15:54, Prasad, Ramit wrote: Core windows commands don't generally accept it, including native Windows applications (although sometimes they're lenient in what they accept). It'll work for command-line Python script usage because it's *python* that allows them, not *windows*. They

Re: [Tutor] create an xls file using data from a txt file

2011-05-11 Thread Prasad, Ramit
>Core windows commands don't generally accept it, including native >Windows applications (although sometimes they're lenient in what they >accept). It'll work for command-line Python script usage because it's >*python* that allows them, not *windows*. They work in *Windows* command prompt nati

Re: [Tutor] create an xls file using data from a txt file

2011-05-11 Thread davidheiserca
;. No problems. - Original Message - From: "Steve Willoughby" To: Sent: Wednesday, May 11, 2011 12:48 PM Subject: Re: [Tutor] create an xls file using data from a txt file On 11-May-11 12:14, James Reynolds wrote: Actually, I never knew that about the windows separators, since

Re: [Tutor] create an xls file using data from a txt file

2011-05-11 Thread Steve Willoughby
On 11-May-11 12:14, James Reynolds wrote: Actually, I never knew that about the windows separators, since I've just always used the '\' out of habit. If you want your code to run everywhere, you should use the functions in os.path to manipulate and build paths. Otherwise, using \ all the tim

Re: [Tutor] create an xls file using data from a txt file

2011-05-11 Thread James Reynolds
Yes, thank you. Actually, I never knew that about the windows separators, since I've just always used the '\' out of habit. On Wed, May 11, 2011 at 2:39 PM, Prasad, Ramit wrote: > > > >your "\" is a "/" > > > > >when writing out a string, such as 'C:\test.xls', the "/" is an escape in > python

Re: [Tutor] create an xls file using data from a txt file

2011-05-11 Thread Prasad, Ramit
>your "\" is a "/" >when writing out a string, such as 'C:\test.xls', the "/" is an escape in >python. So you have two choices, You can either write out path = 'C:\\test.xls', which will be 'C:\test.xls' or you can write out path = r'C:\test.xls' the "r" bit tells python that the following is a

Re: [Tutor] create an xls file using data from a txt file

2011-05-11 Thread Joel Goldstick
On Wed, May 11, 2011 at 1:26 PM, James Reynolds wrote: > your "\" is a "/" > > when writing out a string, such as 'C:\test.xls', the "/" is an escape in > python. So you have two choices, You can either write out path > = 'C:\\test.xls', which will be 'C:\test.xls' or you can write out path = > r

Re: [Tutor] create an xls file using data from a txt file

2011-05-11 Thread James Reynolds
your "\" is a "/" when writing out a string, such as 'C:\test.xls', the "/" is an escape in python. So you have two choices, You can either write out path = 'C:\\test.xls', which will be 'C:\test.xls' or you can write out path = r'C:\test.xls' the "r" bit tells python that the following is a regul

Re: [Tutor] create an xls file using data from a txt file

2011-05-11 Thread James Reynolds
Slow day at work, so I tried something a little different mostly as a learning exercise for myself, let me know what you all think. I thought it would be useful to have a writer that scales and that organizes the data. For example, you might have 20 tests one day, and 5 the next. I broke up the d

Re: [Tutor] create an xls file using data from a txt file

2011-05-11 Thread Walter Prins
On 11 May 2011 14:34, tee chwee liong wrote: > hi all, > > thanks for this sharing. when i copy and run this code, i got this error: > > Traceback (most recent call last): > File "C:/Python25/myscript/excel/sampleexcel.py", line 1, in > import csv > File "C:/Python25/myscript/excel\csv.

Re: [Tutor] create an xls file using data from a txt file

2011-05-11 Thread tee chwee liong
open('output.csv','w')) AttributeError: 'module' object has no attribute 'writer' i'm using Python 2.5 and Win XP. pls help advise. thanks tcl Date: Wed, 11 May 2011 14:05:12 +0100 From: wpr...@gmail.com To: taxbot...@gmail.com CC: tutor@python.

Re: [Tutor] create an xls file using data from a txt file

2011-05-11 Thread Walter Prins
On 11 May 2011 03:57, tax botsis wrote: > I tried to work that out with xlwt but couldn't. Actually, I started > working on the following script but I couldn't even split the line for > further processing: > > OK, I've thrown together a quick sample demonstrating all the concepts you need (obviou

Re: [Tutor] create an xls file using data from a txt file

2011-05-11 Thread Dave Angel
On 01/-10/-28163 02:59 PM, tax botsis wrote: I have the following txt file that has 4 fields that are tab separated: the first is the id and the other three show the results per test. 152 TEST1 valid TEST3 good TEST2 bad 158 TEST2 bad TEST1 bad TEST4 valid . . . Based on the above txt I need to

[Tutor] create an xls file using data from a txt file

2011-05-10 Thread tax botsis
I have the following txt file that has 4 fields that are tab separated: the first is the id and the other three show the results per test. 152 TEST1 valid TEST3 good TEST2 bad 158 TEST2 bad TEST1 bad TEST4 valid . . . Based on the above txt I need to create an xls file having as headers ID, TEST1