The "leading 0 in an integer means it's in octal notation" meme is a peculiar one which originated in C and spread all over the place -- Python (1.* and 2.*), Perl, Ruby, Java... Python 3 has eliminated it by making a leading 0 illegal in all integers (except in the constructs 0x
, 0b
, 0o
to indicate hex, binary and octal notations).
Nevertheless, even in a hypothetical sensible language where a leading 0
in an int had its normal arithmetical meaning, that is, no meaning whatsoever, you still would not obtain your desired result: 011
would then be exactly identical to 11
, so calling str
on either of them would have to produce identical results -- a string of length two, '11'
.
In arithmetic, the integer denoted by decimal notation 011
is identical, exactly the same entity as, indistinguishable from, one and the same with, the integer denoted by decimal notation 11
. No hypothetical sensible language would completely alter the rules of arithmetic, as would be needed to allow you to obtain the result you appear to desire.
So, like everybody else said, just use a string directly -- why not, after all?!