In message
, 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
Il Fri, 29 Oct 2010 19:18:41 -0700, John Yeung ha scritto:
> On Oct 29, 11:59 am, Tracubik wrote:
>> i've to convert integer x to string, but if x < 10, the string have to
>> be '0x' instead of simple 'x'
>>
>> for example:
>>
>> x = 9
>> str(x) --> '09'
>
> Everyone else seems to prefer the for
On Oct 29, 11:59 am, Tracubik wrote:
> i've to convert integer x to string, but if x < 10,
> the string have to be '0x' instead of simple 'x'
>
> for example:
>
> x = 9
> str(x) --> '09'
Everyone else seems to prefer the format-based solutions, which is
fine. I will give zfill a little exposure,
On 29/10/2010 17:18, "none <"@mail.python.org wrote:
On 29/10/10 16:59, Tracubik wrote:
Hi all,
i've to convert integer x to string, but if x< 10, the string have to be
'0x' instead of simple 'x'
for example:
x = 9
str(x) --> '09'
x = 32
str(x) --> '32'
x represent hour/minute/second.
I can
> Hi all,
> i've to convert integer x to string, but if x < 10, the string have to
> be
> '0x' instead of simple 'x'
>
> for example:
>
> x = 9
> str(x) --> '09'
>
> x = 32
> str(x) --> '32'
>
> x represent hour/minute/second.
>
> I can easily add '0' with a if then block, but is there a built
On 29/10/10 16:59, Tracubik wrote:
Hi all,
i've to convert integer x to string, but if x< 10, the string have to be
'0x' instead of simple 'x'
for example:
x = 9
str(x) --> '09'
x = 32
str(x) --> '32'
x represent hour/minute/second.
I can easily add '0' with a if then block, but is there
On 2010-10-29, Tracubik wrote:
> Hi all,
> i've to convert integer x to string, but if x < 10, the string have to be
> '0x' instead of simple 'x'
>
> for example:
>
> x = 9
> str(x) --> '09'
>
> x = 32
> str(x) --> '32'
>
> x represent hour/minute/second.
>
> I can easily add '0' with a if then b
Hi all,
i've to convert integer x to string, but if x < 10, the string have to be
'0x' instead of simple 'x'
for example:
x = 9
str(x) --> '09'
x = 32
str(x) --> '32'
x represent hour/minute/second.
I can easily add '0' with a if then block, but is there a built-in way to
add the '0' automat