str(int_var) formatted
Lawrence D'Oliveiro
ldo at geek-central.gen.new_zealand
Mon Nov 1 23:34:38 EDT 2010
In message
<ab81cc79-9489-41de-9cbc-63dfb259785a at y23g2000yqd.googlegroups.com>, John
Yeung wrote:
> I will give zfill a little exposure, as it seems unloved/underused:
>
> str(x).zfill(2)
The inside of my brain is a finite place. Each thing I put in there leaves
less room for something else. So I have to think very carefully before
deciding what to keep in there.
Up to this point I have learned to do all this kind of formatting using
format strings; is it worth making room in my brain to remember about zfill
as well?
Somehow, I think not.
More information about the Python-list
mailing list