[Tutor] [spoiler] Re: Shifting arrays as though they are a 'word'

Alan Gauld alan.gauld at yahoo.co.uk
Tue Oct 9 03:52:30 EDT 2018


On 09/10/18 02:48, Chip Wachob wrote:

>> bytearray(b'\x00\xff\x7f\x00')
>> py> n = int.from_bytes(b, 'big')
> 
> I'm not familiar with this int.from_bytes.
> 
> Being new to Python, I don't have a mental library of these nifty
> functions.  How / where does one find a library of these wonderful
> functions so I can search to find something that might be really
> handy?

The interactive prompt.
>>> dir(int)

And the help() function

>>> help(int)

And finally the online documentation and search engine.
But dir/help are usually faster.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list