Bengt Richter wrote:
> >*) unless you're living in sweden, in which case "08" is quite often used
> >as an insult.
>
> I am always curious about languages, and considering my name, I think I'd
> like to know this definition ;-) Is it telephone-exchange-related?
it's the area code for Stockholm. I
On Sat, 12 Nov 2005 12:53:17 +0100, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote:
[...]
>int is designed for humans, not C programmers. humans tend to view
>e.g. "08" as a valid decimal number (*), not a ValueError.
[...]
>
>
>*) unless you're living in sweden, in which case "08" is quite often used
On Fri, 11 Nov 2005 16:49:23 -0800, James Colannino wrote:
> Ok, so now I have a very interesting problem, this time related to
> os.chmod. I have the following in a text file: 0600. My script reads
> that number as a string and converts it to an integer for use with
> chmod. However, when I
Gary Herron wrote:
> James Colannino wrote:
>
>> James Colannino wrote:
>>
>>
>>
>>> So then I entered the command print 0600, and saw that the actual
>>> number being output was 384 (why would it output 384?!)
>>>
>>>
>>>
>>
>>
>> Ok, so further research revealed that 0600 is actually the oc
Mike Meyer wrote:
> Strange that int doesn't recognize the leading 0. But you can use the
> second argument to int:
>
> >>> int("0600", 16)
> 1536
> >>>
int is designed for humans, not C programmers. humans tend to view
e.g. "08" as a valid decimal number (*), not a ValueError.
to get programme
Mike Meyer wrote:
> Strange that int doesn't recognize the leading 0. But you can use the
> second argument to int:
>
int("0600", 16)
>
> 1536
You can use it another way too:
>>> int('0600', 0)
384
>>> int('0x180', 0)
384
>>> 0600
384
-Peter
--
http://mail.python.org/mailman/listinfo/p
James Colannino <[EMAIL PROTECTED]> writes:
> James Colannino wrote:
>
>> So then I entered the command print 0600, and saw that the actual
>> number being output was 384 (why would it output 384?!)
>>
>>
>
> Ok, so further research revealed that 0600 is actually the octal
> representation for 384
James Colannino wrote:
>James Colannino wrote:
>
>
>
>>So then I entered the command print 0600, and saw that the
>>actual number being output was 384 (why would it output 384?!)
>>
>>
>>
>>
>
>Ok, so further research revealed that 0600 is actually the octal
>representation for 384 (which
James Colannino wrote:
> Ok, so further research revealed that 0600 is actually the octal
> representation for 384 (which makes sense.) So then, I guess my
> question would have to be, is there a way for me to make Python aware
> that the 0600 I'm passing to int() is octal and not decimal so th
James Colannino wrote:
> I discovered the solution and thought I'd share it with everyone. I
> discovered as I googled that Python used to have a function called
> atoi() that took the parameter base=X. I decided to see if that worked
> with the newer function int() and it did :)
I recommend
James Colannino wrote:
>Ok, so further research revealed that 0600 is actually the octal
>representation for 384 (which makes sense.) So then, I guess my
>question would have to be, is there a way for me to make Python aware
>that the 0600 I'm passing to int() is octal and not decimal so that
James Colannino wrote:
>So then I entered the command print 0600, and saw that the
>actual number being output was 384 (why would it output 384?!)
>
>
Ok, so further research revealed that 0600 is actually the octal
representation for 384 (which makes sense.) So then, I guess my
question wo
12 matches
Mail list logo