Re: [Tutor] Time script help sought!

2005-01-12 Thread Liam Clarke
And I just noticed an error in my correction code! if len(splitLine) = 5 should be - if len(splitLine) == 6 Gah On Thu, 13 Jan 2005 11:48:03 +1300, Liam Clarke <[EMAIL PROTECTED]> wrote: > I'm real sorry. > > My standard disclaimer is now amended to include - "Never post untested code" > > Dis

Re: [Tutor] Time script help sought!

2005-01-12 Thread Liam Clarke
I'm real sorry. My standard disclaimer is now amended to include - "Never post untested code" Disregard everything I wrote above. I feel real bad, so bad that I did something I very rarely do... write complete code. See attached txt file. Guaranteed to work, if you still want to turn Item_4 D

Re: [Tutor] Time script help sought!

2005-01-12 Thread kevin parks
thanks everyone... I will look at all the various appraoches folks came up with and see what i can learnn from them. I ended doing something lame -- a brute force method. I formmatted and reformatted my input data and stuffed it in a HUGE dictionary it was stupid and kludgy i hope to st

Re: [Tutor] Time script help sought!

2005-01-11 Thread Liam Clarke
It's kind of easy - so that stuff you've got there is in a file called dude.inp, for argument's sake - import datetime filename=file("dude.inp","r") lineList=filename.readlines() filename.close() for line in lineList: #This is the hard bit, formatting your in dates splitLine=line.

Re: [Tutor] Time script help sought!

2005-01-11 Thread kevin parks
I also notice that there is the is the 'datetime' module, which is new to version 2.3, which i now have access to. My feeling is that this will do much of what i want, but i can't get my head round the standard library reference stuff http://www.python.org/doc/lib/module-datetime.html I don't h

Re: [Tutor] Time script help sought!

2005-01-11 Thread kevin parks
I am still working on it and also fixing the input data. I think for simplicity and consistency's sake i will have *all* time values input and output as hh:mm:ss maybe that would be easier for now.. so i am editing the input stuff now... so it should all look like: Item_1, DAT_1, 1, 00:00:23, 0

Re: [Tutor] Time script help sought!

2005-01-11 Thread jfouhy
Quoting "Jacob S." <[EMAIL PROTECTED]>: > > The old mx.datetime module (on which Python's datetime module is based, I > > presume) had a strptime() function which would basically do the reverse (you > > specify a format string and it would attempt to parse the date string you > > give > > it). Un

Re: [Tutor] Time script help sought!

2005-01-11 Thread Jacob S.
Forgot to mention -- screwed up before. In my proposed try/except block, etc. I forgot to do unit conversion. Jacob ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Time script help sought!

2005-01-11 Thread Jacob S.
> The old mx.datetime module (on which Python's datetime module is based, I > presume) had a strptime() function which would basically do the reverse (you > specify a format string and it would attempt to parse the date string you give > it). Unfortunately, Python's datetime module doesn't have su

Re: [Tutor] Time script help sought!

2005-01-11 Thread jfouhy
Quoting "Jacob S." <[EMAIL PROTECTED]>: > I don't think so. (correct me if I'm wrong) The datetime module is for > making date and time instances that you can add and subtract to get > timedelta objects. Other things involved of course, but I don't think it > has anything to do with parsing and >

Re: [Tutor] Time script help sought!

2005-01-11 Thread Jacob S.
I don't think so. (correct me if I'm wrong) The datetime module is for making date and time instances that you can add and subtract to get timedelta objects. Other things involved of course, but I don't think it has anything to do with parsing and pretty printing columns of times. I'm not sure, don

Re: [Tutor] Time script help sought!

2005-01-11 Thread Jacob S.
Would this do the trick? stringtime = '12:34' ## This is the column with the time 12:34 is an example time = stringtime.split(":") time = [int(x) for x in time] time.reverse() seconds = time[0]+time[1] try: seconds += time[2] except IndexError: pass print seconds I'm almost sure there

Re: [Tutor] Time script help sought!

2005-01-11 Thread kevin parks
Thanks for this Everyone! Trying to work with all the stuff folks are giving me on this i a have come across a problem... down the line i notice that some of the times will also have an hour as well as in H:M:S (e.g. 1:22:40) so in some cases i would need to convert H:M:S to sec and some just M:

Re: [Tutor] Time script help sought!

2005-01-11 Thread Ismael Garrido
kevin parks wrote: I am kind of in a bit of a jam (okay a big jam) and i was hoping that someone here could give me a quick hand. I had a few pages of time calculations to do. So, i just started in on them typing them in my time calculator and writing them in by hand. Now i realize, that i rea

Re: [Tutor] Time script help sought!

2005-01-11 Thread Danny Yoo
On Tue, 11 Jan 2005, kevin parks wrote: > but as always you may notice a wrinkle some items have many times > (here 6) indicated: > > Item_3TAPE_139:4110:41 > Item_3TAPE_1410:4711:19 > Item_3TAPE_1511:2111:55 > Item_3TAPE_1611:58

Re: [Tutor] Time script help sought!

2005-01-11 Thread Paul Tremblay
12:18:15PM -0500, kevin parks wrote: > From: kevin parks <[EMAIL PROTECTED]> > Date: Tue, 11 Jan 2005 12:18:15 -0500 > To: tutor@python.org > Cc: Kevin Parks <[EMAIL PROTECTED]> > Subject: [Tutor] Time script help sought! > > I am kind of in a bit of a jam

[Tutor] Time script help sought!

2005-01-11 Thread kevin parks
I am kind of in a bit of a jam (okay a big jam) and i was hoping that someone here could give me a quick hand. I had a few pages of time calculations to do. So, i just started in on them typing them in my time calculator and writing them in by hand. Now i realize, that i really need a script t