integer's methods

ast nomail at com.invalid
Thu Aug 18 08:58:52 EDT 2016


Hello

I wonder why calling a method on an integer
doesn't work ?

>>> 123.bit_length()
SyntaxError: invalid syntax

>>> 123.to_bytes(3, 'big')
SyntaxError: invalid syntax

but it works with a variable

>>> i = 123
>>> i.bit_length()
7

>>> i=123
>>> i.to_bytes(3, 'big')
b'\x00\x00{'

I am working with pyhton 3.5.1

thx



More information about the Python-list mailing list