A few questiosn about encoding

Νικόλαος Κούρας support at superhost.gr
Thu Jun 13 04:08:04 EDT 2013


On 13/6/2013 10:58 πμ, Chris Angelico wrote:
> On Thu, Jun 13, 2013 at 5:42 PM, �������� ������ <support at superhost.gr> wrote:
>> On 13/6/2013 10:11 ��, Steven D'Aprano wrote:
>>> No! That creates a string from 16474 in base two:
>>> '0b100000001011010'
>>
>> I disagree here.
>> 16474 is a number in base 10. Doing bin(16474) we get the binary
>> representation of number 16474 and not a string.
>> Why you say we receive a string while python presents a binary number?
>
> You can disagree all you like. Steven cited a simple point of fact,
> one which can be verified in any Python interpreter. Nikos, you are
> flat wrong here; bin(16474) creates a string.

Indeed python embraced it in single quoting '0b100000001011010' and not 
as 0b100000001011010 which in fact makes it a string.

But since bin(16474) seems to create a string rather than an expected 
number(at leat into my mind) then how do we get the binary 
representation of the number 16474 as a number?



More information about the Python-list mailing list