converting an int to a string
Diez B. Roggisch
deets at nospam.web.de
Fri Jun 8 11:49:55 EDT 2007
Sean Farrow schrieb:
> Hi:
> I have the folling code:
> def parseTime(self, time):
> minutes =int(float(time)/60)
> seconds =int(float(time)-minutes*60)
> minutes =str(minutes)
> seconds =str(minutes)
> the statements that convert the minutes and seconds variables
> str(minutes) and str(seconds) don't seem to be working.
> Any idea why?
> is there any other way of doing this and perhaps using the $d
> interpolation operator?
What do you mean by "don't seem to be working"
Usually, they do:
Python 2.4.4 (#1, Oct 18 2006, 10:34:39)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Welcome to rlcompleter2 0.96
for nice experiences hit <tab> multiple times
>>> str(120)
'120'
>>>
Any change you overdefined str with something weird?
Diez
More information about the Python-list
mailing list