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"
> 
> 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 DAT 5 12:32:05 12:37:13 Funny crackling noise
> 
> into Item_4 DAT 5 00:00:00 00:05:08 Funny crackling noise
> 
> Please note comment can be included. Not overly hard.
> 
> HTH,
> 
> (And sorry for erroneous datetime stuff. Particularly
> datetime.datetime(timedelta object)
> That definitely doesn't work.)
> 
> Never post untested code
> 
> Liam Clarke
> 
> On Wed, 12 Jan 2005 10:08:02 -0500, kevin parks <[EMAIL PROTECTED]> wrote:
> > 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 study all these approaches and learn something
> > that may help me do something that is more flexible about the input
> > data and is more elegant..... here's what i
> > came up with ... with my pea sized brain...
> >
> > #!/usr/bin/env python
> >
> > # New in version 2.3 is the 'datetime' module (see standard library
> > reference)
> > # http://www.python.org/doc/lib/module-datetime.html
> >
> > import datetime
> >
> > inseqs = { (1) : ['DAT_1', '01', '00:00:23', '00:08:23'],
> > (2) : ['DAT_1', '02', '00:08:23', '00:09:41'],
> > (513) : ['DAT_75', '10', '00:59:55', '01:11:05'],
> > (514) : ['DAT_75', '11', '01:11:05', '01:16:15'],
> > (515) : ['DAT_75', '12', '01:16:15', '01:34:15'],
> > (516) : ['DAT_75', '13', '01:34:15', '01:45:15'],
> > (517) : ['DAT_75', '14', '01:45:15', '01:48:00'] }
> >
> > mykeys = inseqs.keys()      # first make a copy of the keys
> > mykeys.sort()               # now sort that copy in place
> >
> > for key in mykeys:
> >      event = inseqs[key]
> >      print '\n','Item #', key, event
> >      TD = datetime.timedelta
> >      h, m, s = event[2].split(':')
> >      zero_adjust = TD(hours=int(h), minutes=int(m),seconds=int(s))
> >      #
> >      print ' Q___ ', key, event[:2], ': ',
> >      for item in event[2:]:
> >          hrs, mins, secs, = item.split(':')
> >          time1 = TD(hours=int(hrs), minutes=int(mins),seconds=int(secs))
> >          print time1 - zero_adjust,
> >
> >      print
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor@python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >
> 
> --
> 'There is only one basic human right, and that is to do as you damn well 
> please.
> And with it comes the only basic human duty, to take the consequences.
> 
> 
> 


-- 
'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic human duty, to take the consequences.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to