module属性

test_module.py

'''
Created on Feb 28, 2013

@author: agent
'''
import sys

name = 42

def func(path):
    print path

class Klass: pass

print 'done loading.'

if __name__ == '__main__':
    pass

test:

import test_module

print test_module.__dict__.keys()
print test_module.__file__
print test_module.__name__
print test_module.__doc__

result:


done loading.
['name', '__builtins__', '__file__', '__package__', 'sys', 'Klass', 'func', '__name__', '__doc__']
C:\Documents and Settings\agent\workspace\python_test\note\test_module.pyc
test_module


Created on Feb 28, 2013


@author: agent

 

 

posted @ 2013-02-28 10:43  道以万计  阅读(175)  评论(0编辑  收藏  举报