Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #65588
| Subject | Re: Python 2.7.6 help with white spaces? |
|---|---|
| From | Scott W Dunning <swdunning@cox.net> |
| Date | 2014-02-06 21:12 -0700 |
| References | <mailman.6467.1391736132.18130.python-list@python.org> <PDY91n0183bjUJS01DYAz7> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.6477.1391746338.18130.python-list@python.org> (permalink) |
what exactly is the “%d:%02d”% saying? On Feb 6, 2014, at 6:25 PM, Roy Smith <roy@panix.com> wrote: > In article <mailman.6467.1391736132.18130.python-list@python.org>, > Scott W Dunning <swdunning@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. > -- > https://mail.python.org/mailman/listinfo/python-list
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Python 2.7.6 help with white spaces? Scott W Dunning <swdunning@cox.net> - 2014-02-06 18:22 -0700 Re: Python 2.7.6 help with white spaces? Roy Smith <roy@panix.com> - 2014-02-06 20:25 -0500 Re: Python 2.7.6 help with white spaces? Scott W Dunning <swdunning@cox.net> - 2014-02-06 21:12 -0700 Re: Python 2.7.6 help with white spaces? Roy Smith <roy@panix.com> - 2014-02-06 23:26 -0500
csiph-web