#怎样学习一个新的模块呢


#1.dir
'''
print [n for n in dir(copy) if not n.startswith('_')]
pp (dir(copy))
'''
#2.copy.__all__的意义,不是必须有的
#告诉import copy导入所有方法的时候,到底是导入哪些方法呢
'''
print copy.__all__
#__all__ = ["Error", "copy", "deepcopy"]

import urllib
print urllib.__all__
#['urlopen', 'URLopener', 'FancyURLopener', 'urlretrieve', 'urlcleanup', 'quote', 'quote_plus', 'unquote', 'unquote_plus', 'urlencode', 'url2pathname', 'pathname2url', 'splittag', 'localhost', 'thishost', 'ftperrors', 'basejoin', 'unwrap', 'splittype', 'splithost', 'splituser', 'splitpasswd', 'splitport', 'splitnport',
# 'splitquery', 'splitattr', 'splitvalue', 'getproxies']
'''
#3.help用法
'''
help(copy.copy)
'''
#4.__doc__用法
'''
print copy.copy.__doc__
'''
#5 查看源代码__file__
'''
print copy.__file__
#C:\Python27\lib\copy.pyc
'''

posted @ 2018-03-06 17:01  米 立  阅读(188)  评论(0编辑  收藏  举报