Net-informations.com
SiteMap  | About    

Difference between dir() and help()

In Python, help() is a super useful built-in function that can be used to return the Python documentation of a particular object, method, attributes, etc.

example

output

In python, dir() shows a list of attributes for the object passed in as argument , without an argument it returns the list of names in the current local namespace (similar to locals().keys() ) .

example

output

There is no hard rules as to what they will give, consequently they may change from version to version. Any differences are unlikely to be deliberate, but merely side-effects of the specific implementation of each.









net-informations.com (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.