[FRPythoneers] Data type conversion

jafo at tummy.com jafo at tummy.com
Wed May 2 09:56:57 MDT 2001

On Wed, May 02, 2001 at 09:50:51AM -0600, J. Wayde Allen wrote:
>hhmmss format.  I was thinking something like:
>         sampletime = string.join((hours,minutes,seconds),'')

sampletime = '%02d%02d%02f' % ( hours, minutes, seconds )

You could use something like:

   string.join(( str(hours), str(minutes), str(seconds) ), '')

but that's probably not the clearest way to do it, and if you have a
minutes of 5 you'll get HHMSS, right?  Try the %formatting stuff.

 [...] Premature optimization is the root of all evil.
                 -- Donald Knuth
Sean Reifschneider, Inimitably Superfluous <jafo at tummy.com>
tummy.com - Linux Consulting since 1995. Qmail, KRUD, Firewalls, Python

More information about the FRPythoneers mailing list