def printer(x): print x
���W���[���̖��O��Ԃׂ�D>>> import module1 >>> module1.printer('Hello World!') Hello World >>> from module1 import printer >>> printer('Hello World!') Hello World! >>> from module1 import * >>> printer('Hello World!') Hello World!
__doc__ �́i���X�j�֗�>>> dir(module1) ['__builtins__', '__doc__', '__file__', '__name__', 'printer'] >>> module1.__dict__.keys() ['__doc__', 'printer', '__file__', '__name__', '__builtins__']
>>> import math >>> dir(math) ['__doc__', '__name__', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'cosh', 'e', 'exp', 'fabs', 'floor', 'fmod', 'frexp', 'hypot', 'ldexp', 'log', 'log10', 'modf', 'pi', 'pow', 'sin', 'sinh', 'sqrt', 'tan', 'tanh'] >>> print math.__doc__ This module is always available. It provides access to the mathematical functions defined by the C standard. >>> print math.ceil.__doc__ ceil(x) Return the ceiling of x as a real.
>>> import simple hello >>> simple.spam 1 >>> simple.spam = 2 >>> import simple >>> simple.spam 2 >>> reload(simple) hello <module 'simple' from 'C:\home\papa\lips\prog-method\simple.pyc'> >>> simple.spam 1
>>> from small import x, y >>> x = 42 >>> y[0] = 42 >>> import small >>> small.x 1 >>> small.y [42, 2]
�ȏ�̂悤�ɁC���W���[���̃e�X�g�R�[�h���ɕt���Ă������Ƃ��ł���D% python >>> import runme >>> runme.tester('Kochi') It's Christmas in Kochi... >>> % python runme.py It's Christmas in Heaven...