what exactly is the “%d:%02d”% saying?
On Feb 6, 2014, at 6:25 PM, Roy Smith <[email protected]> wrote: > In article <[email protected]>, > Scott W Dunning <[email protected]> wrote: > >> I am having trouble figuring out how to remove spacesŠ. >> >> Assume variables exist for minutes and seconds. Each variable is an integer. >> How would you create a string in the format, >> >> 3:11 >> >> with no spaces. where 3 is minutes and 11 is seconds. >> >> >> Obviously when IŠ >> >> print minutes, ³:², seconds >> >> I get 3 : 11 >> >> how can I get it to print with no spaces? >> >> 3:11 > > print "%d:%02d" % (minutes, seconds) > > The "02" for the seconds specifier makes sure you get exactly two > digits, with a leading zero if needed. > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
