Python 2.7.6 help with white spaces?
Roy Smith
roy at panix.com
Thu Feb 6 20:25:47 EST 2014
In article <mailman.6467.1391736132.18130.python-list at python.org>,
Scott W Dunning <swdunning at cox.net> 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.
More information about the Python-list
mailing list