Ví dụ
#!/usr/bin/python # Import module built-in math import math content = dir(math) print content
Kết quả
Khi mã trên chạy, kết quả:
['__doc__', '__file__', '__name__', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'cosh', 'degrees', 'e', 'exp', 'fabs', 'floor', 'fmod', 'frexp', 'hypot', 'ldexp', 'log', 'log10', 'modf', 'pi', 'pow', 'radians', 'sin', 'sinh', 'sqrt', 'tan', 'tanh']
Ở đây, biến chuỗi đặc biệt __name__ là tên module, và __file__ là tên file từ đó module được load.