[EMAIL PROTECTED] wrote:
>...

>>>             if float(seconds[0]) < 10: seconds[0] = '0' +
>>> seconds[0][:-1]
>>>             if float(seconds[1]) < 10: seconds[1] = '0' +
>>> seconds[1][:-1]        I've not handled leading 0s on the seconds field (I 
>>> tried, but can't
>> figure out how to specify zero-filled field width for floats -- works
>> for integers)
> 
> I ran into the same problem, thats why I did it the way I did, instead
> of continuing to wrestle with python's string formatting.

For this portion, you could quite simply:

      totalsecs = int(whatever)
      print '%02d:%02d' % divmod(totalsecs, 60)

Or, depending on your leading zero requirements:

      totalsecs = int(whatever)
      print '%2d:%02d' % divmod(totalsecs, 60)

--Scott David Daniels
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to