auch wenn die Frage längst beantwortet ist, möchte ich Dich auf ein interessantes Feature von Python aufmerksam machen, daß auch in in vielen Fälle (inzwischen kaum mehr bei pythoneigenen Modulen) anwende, nämlich dir() wenn man den Interpreter startet:
Code: Alles auswählen
#was ist augenblicklich im Namespace?
>>> dir()
['__builtins__', '__doc__', '__file__', '__name__']
# nicht so furchtbar viel, aber was kann denn eine Liste?
>>> dir(list())
['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__delslice__',
'__doc__', '__eq__', '__ge__', '__getattribute__', '__getitem__', '__getslice__',
'__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__iter__', '__le__',
'__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__',
'__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__',
'__setitem__', '__setslice__', '__str__', 'append', 'count', 'extend', 'index', 'insert',
'pop', 'remove', 'reverse', 'sort']
# hm, das geht auch bei anderen (importierten) Objekten: dir(object)
# und was geben die builtins her?
>>> dir(__builtins__)
['ArithmeticError', 'AssertionError', 'AttributeError', 'DeprecationWarning', 'EOFError',
'Ellipsis', 'EnvironmentError', 'Exception', 'False', 'FloatingPointError',
'FutureWarning', 'IOError', 'ImportError', 'IndentationError', 'IndexError', 'KeyError',
'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError', 'None',
'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'OverflowWarning',
'PendingDeprecationWarning', 'ReferenceError', 'RuntimeError', 'RuntimeWarning',
'StandardError', 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError',
'SystemExit', 'TabError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError',
'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UserWarning',
'ValueError', 'Warning', 'ZeroDivisionError', '_', '__debug__', '__doc__', '__import__',
'__name__', 'abs', 'apply', 'basestring', 'bool', 'buffer', 'callable', 'chr', 'classmethod',
'cmp', 'coerce', 'compile', 'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod',
'enumerate', 'eval', 'execfile', 'exit', 'file', 'filter', 'float', 'frozenset', 'getattr', 'globals',
'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'intern', 'isinstance', 'issubclass', 'iter',
'len', 'license', 'list', 'locals', 'long', 'map', 'max', 'min', 'object', 'oct', 'open', 'ord', 'pow',
'property', 'quit', 'range', 'raw_input', 'reduce', 'reload', 'repr', 'reversed', 'round', 'set',
'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'unichr',
'unicode', 'vars', 'xrange', 'zip']
# verdammt viel, sogar max() ist dabei
# und was kann es, wie funktioniert es?
>>> print max.__doc__
max(sequence) -> value
max(a, b, c, ...) -> value
With a single sequence argument, return its largest item.
With two or more arguments, return the largest argument.
# oder
>>> help(max)
Toll, was Python alles bietet, oder? Und gerade den Einstieg macht es leicht ...
edit: Kleine Korrektur und künstliche Zeilenumbrüche, damit der Post noch lesbar ist.