HELP utility in Python

Connect to Python in IDLE. Then type “help()” and hit enter.
Then you will see that something like below:


Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> help()

Welcome to Python 2.7! This is the online help utility.

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules. To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics". Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".

help>

Now you can see that we are into help utility.
So for example I want to know about the modules that are installed in my Python I just need to type “module” and hit enter to get all the list
For example :

help> modules

Please wait a moment while I gather a list of all available modules...

AutoComplete _locale fractions rexec
AutoCompleteWindow _lsprof ftplib rfc822
AutoExpand _md5 functools rlcompleter
BaseHTTPServer _msi future_builtins robotparser
Bastion _multibytecodec gc rpc
Bindings _multiprocessing genericpath run
CGIHTTPServer _pyio getopt runpy
CallTipWindow _random getpass sched
CallTips _sha gettext select
Canvas _sha256 glob sets
ClassBrowser _sha512 gzip sgmllib
CodeContext _socket hashlib sha
ColorDelegator _sqlite3 heapq shelve
ConfigParser _sre hmac shlex
Cookie _ssl hotshot shutil
Debugger _strptime htmlentitydefs signal
Delegator _struct htmllib site
Dialog _subprocess httplib smtpd
DocXMLRPCServer _symtable idle smtplib
EditorWindow _testcapi idlelib sndhdr
FileDialog _threading_local idlever socket
FileList _tkinter ihooks sqlite3
FixTk _warnings imageop sre
FormatParagraph _weakref imaplib sre_compile
GrepDialog _weakrefset imghdr sre_constants
HTMLParser _winreg imp sre_parse
HyperParser abc importlib ssl
IOBinding aboutDialog imputil stat
IdleHistory aifc inspect statvfs
MimeWriter antigravity io string
MultiCall anydbm itertools stringold
MultiStatusBar argparse json stringprep
ObjectBrowser array keybindingDialog strop
OutputWindow ast keyword struct
ParenMatch asynchat lib2to3 subprocess
PathBrowser asyncore linecache sunau
Percolator atexit locale sunaudio
PyParse audiodev logging symbol
PyShell audioop macosxSupport symtable
Queue base64 macpath sys
RemoteDebugger bdb macurl2path sysconfig
RemoteObjectBrowser binascii mailbox tabbedpages
ReplaceDialog binhex mailcap tabnanny
RstripExtension bisect markupbase tarfile
ScriptBinding bsddb marshal telnetlib
ScrolledList bz2 math tempfile
ScrolledText cPickle md5 test
SearchDialog cProfile mhlib testcode
SearchDialogBase cStringIO mimetools textView
SearchEngine calendar mimetypes textwrap
SimpleDialog cgi mimify this
SimpleHTTPServer cgitb mmap thread
SimpleXMLRPCServer chunk modulefinder threading
SocketServer cmath msilib time
StackViewer cmd msvcrt timeit
StringIO code multifile tkColorChooser
Tix codecs multiprocessing tkCommonDialog
Tkconstants codeop mutex tkFileDialog
Tkdnd collections netrc tkFont
Tkinter colorsys new tkMessageBox
ToolTip commands nntplib tkSimpleDialog
TreeWidget compileall nt toaiff
UndoDelegator compiler ntpath token
UserDict configDialog nturl2path tokenize
UserList configHandler numbers trace
UserString configHelpSourceEdit opcode traceback
WidgetRedirector configSectionNameDialog operator ttk
WindowList contextlib optparse tty
ZoomHeight cookielib os turtle
_LWPCookieJar copy os2emxpath types
_MozillaCookieJar copy_reg parser unicodedata
__builtin__ csv pdb unittest
__future__ ctypes pickle urllib
_abcoll curses pickletools urllib2
_ast datetime pipes urlparse
_bisect dbhash pkgutil user
_bsddb decimal platform uu
_codecs difflib plistlib uuid
_codecs_cn dircache popen2 warnings
_codecs_hk dis poplib wave
_codecs_iso2022 distutils posixfile weakref
_codecs_jp doctest posixpath webbrowser
_codecs_kr dumbdbm pprint whichdb
_codecs_tw dummy_thread profile winsound
_collections dummy_threading pstats wsgiref
_csv dynOptionMenuWidget pty xdrlib
_ctypes email py_compile xml
_ctypes_test encodings pyclbr xmllib
_elementtree errno pydoc xmlrpclib
_functools exceptions pydoc_data xxsubtype
_hashlib filecmp pyexpat zipfile
_heapq fileinput quopri zipimport
_hotshot fnmatch random zlib
_io formatter re
_json fpformat repr

Enter any module name to get more help. Or, type "modules spam" to search
for modules whose descriptions contain the word "spam".

help>

Now if I want to know about math module like how to use it then I need to type ” math ” under help utility and hit enter to get the information on MATH module.

Below example shows how to get MATH module information from Python HELP  utility :

help> math
Help on built-in module math:

NAME
 math

FILE
 (built-in)

DESCRIPTION
 This module is always available. It provides access to the
 mathematical functions defined by the C standard.

FUNCTIONS
 acos(...)
 acos(x)

 Return the arc cosine (measured in radians) of x.

 acosh(...)
 acosh(x)

 Return the hyperbolic arc cosine (measured in radians) of x.

 asin(...)
 asin(x)

 Return the arc sine (measured in radians) of x.

 asinh(...)
 asinh(x)

 Return the hyperbolic arc sine (measured in radians) of x.

 atan(...)
 atan(x)

 Return the arc tangent (measured in radians) of x.

 atan2(...)
 atan2(y, x)

 Return the arc tangent (measured in radians) of y/x.
 Unlike atan(y/x), the signs of both x and y are considered.

 atanh(...)
 atanh(x)

 Return the hyperbolic arc tangent (measured in radians) of x.

 ceil(...)
 ceil(x)

 Return the ceiling of x as a float.
 This is the smallest integral value >= x.

 copysign(...)
 copysign(x, y)

 Return x with the sign of y.

 cos(...)
 cos(x)

 Return the cosine of x (measured in radians).

 cosh(...)
 cosh(x)

 Return the hyperbolic cosine of x.

 degrees(...)
 degrees(x)

 Convert angle x from radians to degrees.

 erf(...)
 erf(x)

 Error function at x.

 erfc(...)
 erfc(x)

 Complementary error function at x.

 exp(...)
 exp(x)

 Return e raised to the power of x.

 expm1(...)
 expm1(x)

 Return exp(x)-1.
 This function avoids the loss of precision involved in the direct evaluation of exp(x)-1 for small x.

 fabs(...)
 fabs(x)

 Return the absolute value of the float x.

 factorial(...)
 factorial(x) -> Integral

 Find x!. Raise a ValueError if x is negative or non-integral.

 floor(...)
 floor(x)

 Return the floor of x as a float.
 This is the largest integral value <= x.

 fmod(...)
 fmod(x, y)

 Return fmod(x, y), according to platform C. x % y may differ.

 frexp(...)
 frexp(x)

 Return the mantissa and exponent of x, as pair (m, e).
 m is a float and e is an int, such that x = m * 2.**e.
 If x is 0, m and e are both 0. Else 0.5 <= abs(m) < 1.0.

 fsum(...)
 fsum(iterable)

 Return an accurate floating point sum of values in the iterable.
 Assumes IEEE-754 floating point arithmetic.

 gamma(...)
 gamma(x)

 Gamma function at x.

 hypot(...)
 hypot(x, y)

 Return the Euclidean distance, sqrt(x*x + y*y).

 isinf(...)
 isinf(x) -> bool

 Check if float x is infinite (positive or negative).

 isnan(...)
 isnan(x) -> bool

 Check if float x is not a number (NaN).

 ldexp(...)
 ldexp(x, i)

 Return x * (2**i).

 lgamma(...)
 lgamma(x)

 Natural logarithm of absolute value of Gamma function at x.

 log(...)
 log(x[, base])

 Return the logarithm of x to the given base.
 If the base not specified, returns the natural logarithm (base e) of x.

 log10(...)
 log10(x)

 Return the base 10 logarithm of x.

 log1p(...)
 log1p(x)

 Return the natural logarithm of 1+x (base e).
 The result is computed in a way which is accurate for x near zero.

 modf(...)
 modf(x)

 Return the fractional and integer parts of x. Both results carry the sign
 of x and are floats.

 pow(...)
 pow(x, y)

 Return x**y (x to the power of y).

 radians(...)
 radians(x)

 Convert angle x from degrees to radians.

 sin(...)
 sin(x)

 Return the sine of x (measured in radians).

 sinh(...)
 sinh(x)

 Return the hyperbolic sine of x.

 sqrt(...)
 sqrt(x)

 Return the square root of x.

 tan(...)
 tan(x)

 Return the tangent of x (measured in radians).

 tanh(...)
 tanh(x)

 Return the hyperbolic tangent of x.

 trunc(...)
 trunc(x:Real) -> Integral

 Truncates x to the nearest Integral toward 0. Uses the __trunc__ magic method.

DATA
 e = 2.718281828459045
 pi = 3.141592653589793
help>

Similar way you can explore all the modules ,functions and all keywords that you want to use inside your Python code.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s