PBE logo

Welcome to Python by Example!ΒΆ

This guide aims to show examples of the most useful Python Library functions, methods, and classes. At this point, only the more widely used modules were added. Python version 2.5 was used for the examples unless noted otherwise. An example of output of a function will be shown in the form of function_call(args) # result, when the result is the actual output, it is shown after the comment sign, if it’s a description of an outcome, e.g. a raised exception, it will be shown in square brackets:

>>> math.sqrt(9)   # 3.0
>>> 1/0            # [raises ZeroDivisionError]