[FRPythoneers] Data type conversion

Ken Kinder kkinder at tridog.com
Wed May 2 09:58:42 MDT 2001


Wade,

You want str(variable) -- it would convert an int of value 5 to a string
of value "5"

"J. Wayde Allen" wrote:
> 
> OK, new problem for the day.  I've succeeded in pulling an ASCII string
> representing a time of day out of my data file, and have applied a
> numerical offset to this.
> 
>         #Compute the sample time
>          hours = string.atoi(timestamp[0:2])
>          minutes = string.atoi(timestamp[2:4])
>          seconds = string.atof(timestamp[4:6])
>          offset = offset - 2
>          seconds = seconds + offset
>          if seconds < 0:
>             minutes = minutes - 1
>             seconds = seconds + 60
>          if minutes < 0:
>             hours = hours - 1
>             minutes = minutes + 60
>          if hours < 0:             #Previous day
>             hours = hours + 24
> 
> At this time I'd like to put the pieces back together again in the same
> hhmmss format.  I was thinking something like:
> 
>          sampletime = string.join((hours,minutes,seconds),'')
> 
> The problem is that my hours, minutes, and seconds are now of type integer
> and float.  So how do I convert them back to string form?
> 
> - Wayde
>   (wallen at lug.boulder.co.us)
> 
> _______________________________________________
> This message sent by the FRPythoneers mailing list.
> Unsubscribe: echo unsubscribe | FRPythoneers-request at lists.community.tummy.com
> URL: http://lists.community.tummy.com/mailman/listinfo/frpythoneers

-- 
Ken Kinder
Engineer
Tridog Interactive, Inc.



More information about the FRPythoneers mailing list