import sys
import site def print_all(module_):
modulelist = dir(module_)
length = len(modulelist)
for i in range(0,length,1):
print(module_, modulelist[i])
print(getattr(module_,modulelist[i])) print_all(site)

结果如下:

D:\Python\Python35\python.exe C:/Users/wangcf/PycharmProjects/untitled/lplatform.py
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> CONFIG_LINE
^(?P<key>(\w|[-_])+)\s*=\s*(?P<value>.*)\s*$
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> ENABLE_USER_SITE
True
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> PREFIXES
['D:\\Python\\Python35', 'D:\\Python\\Python35']
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> USER_BASE
C:\Users\wangcf\AppData\Roaming\Python
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> USER_SITE
C:\Users\wangcf\AppData\Roaming\Python\Python35\site-packages
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> __builtins__
{'IndexError': <class 'IndexError'>, 'GeneratorExit': <class 'GeneratorExit'>, 'ConnectionError': <class 'ConnectionError'>, 'OverflowError': <class 'OverflowError'>, 'license': Type license() to see the full license text, 'eval': <built-in function eval>, 'StopAsyncIteration': <class 'StopAsyncIteration'>, 'hasattr': <built-in function hasattr>, '__import__': <built-in function __import__>, 'SyntaxError': <class 'SyntaxError'>, 'ProcessLookupError': <class 'ProcessLookupError'>, 'format': <built-in function format>, '__loader__': <class '_frozen_importlib.BuiltinImporter'>, 'OSError': <class 'OSError'>, 'type': <class 'type'>, 'KeyboardInterrupt': <class 'KeyboardInterrupt'>, 'max': <built-in function max>, 'ImportWarning': <class 'ImportWarning'>, 'enumerate': <class 'enumerate'>, 'ValueError': <class 'ValueError'>, 'bytes': <class 'bytes'>, 'all': <built-in function all>, 'SyntaxWarning': <class 'SyntaxWarning'>, 'vars': <built-in function vars>, 'ord': <built-in function ord>, 'ascii': <built-in function ascii>, 'callable': <built-in function callable>, 'credits': Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
for supporting Python development. See www.python.org for more information., 'BytesWarning': <class 'BytesWarning'>, 'oct': <built-in function oct>, 'iter': <built-in function iter>, 'dir': <built-in function dir>, 'SystemError': <class 'SystemError'>, 'len': <built-in function len>, 'filter': <class 'filter'>, '__package__': '', 'SystemExit': <class 'SystemExit'>, 'frozenset': <class 'frozenset'>, '__build_class__': <built-in function __build_class__>, 'setattr': <built-in function setattr>, 'object': <class 'object'>, 'BaseException': <class 'BaseException'>, 'IsADirectoryError': <class 'IsADirectoryError'>, '__debug__': True, 'NameError': <class 'NameError'>, 'print': <built-in function print>, 'ImportError': <class 'ImportError'>, 'StopIteration': <class 'StopIteration'>, 'complex': <class 'complex'>, 'ChildProcessError': <class 'ChildProcessError'>, '__doc__': "Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in slices.", 'NotImplementedError': <class 'NotImplementedError'>, 'EOFError': <class 'EOFError'>, 'bool': <class 'bool'>, 'LookupError': <class 'LookupError'>, 'UnboundLocalError': <class 'UnboundLocalError'>, 'abs': <built-in function abs>, 'classmethod': <class 'classmethod'>, 'RecursionError': <class 'RecursionError'>, '__spec__': ModuleSpec(name='builtins', loader=<class '_frozen_importlib.BuiltinImporter'>), 'copyright': Copyright (c) 2001-2015 Python Software Foundation.
All Rights Reserved. Copyright (c) 2000 BeOpen.com.
All Rights Reserved. Copyright (c) 1995-2001 Corporation for National Research Initiatives.
All Rights Reserved. Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.
All Rights Reserved., 'isinstance': <built-in function isinstance>, 'getattr': <built-in function getattr>, 'FutureWarning': <class 'FutureWarning'>, 'ZeroDivisionError': <class 'ZeroDivisionError'>, 'Ellipsis': Ellipsis, 'False': False, 'ReferenceError': <class 'ReferenceError'>, 'NotImplemented': NotImplemented, 'exit': Use exit() or Ctrl-Z plus Return to exit, 'AttributeError': <class 'AttributeError'>, 'EnvironmentError': <class 'OSError'>, 'FileExistsError': <class 'FileExistsError'>, 'RuntimeError': <class 'RuntimeError'>, 'compile': <built-in function compile>, 'IndentationError': <class 'IndentationError'>, 'NotADirectoryError': <class 'NotADirectoryError'>, 'issubclass': <built-in function issubclass>, 'memoryview': <class 'memoryview'>, 'str': <class 'str'>, 'map': <class 'map'>, 'TabError': <class 'TabError'>, 'globals': <built-in function globals>, 'UnicodeTranslateError': <class 'UnicodeTranslateError'>, 'TimeoutError': <class 'TimeoutError'>, 'sorted': <built-in function sorted>, 'UserWarning': <class 'UserWarning'>, 'MemoryError': <class 'MemoryError'>, 'open': <built-in function open>, 'True': True, 'float': <class 'float'>, 'ConnectionAbortedError': <class 'ConnectionAbortedError'>, 'RuntimeWarning': <class 'RuntimeWarning'>, 'quit': Use quit() or Ctrl-Z plus Return to exit, '__name__': 'builtins', 'Warning': <class 'Warning'>, 'divmod': <built-in function divmod>, 'AssertionError': <class 'AssertionError'>, 'ConnectionResetError': <class 'ConnectionResetError'>, 'KeyError': <class 'KeyError'>, 'FileNotFoundError': <class 'FileNotFoundError'>, 'UnicodeWarning': <class 'UnicodeWarning'>, 'hash': <built-in function hash>, 'hex': <built-in function hex>, 'DeprecationWarning': <class 'DeprecationWarning'>, 'locals': <built-in function locals>, 'min': <built-in function min>, 'ResourceWarning': <class 'ResourceWarning'>, 'WindowsError': <class 'OSError'>, 'chr': <built-in function chr>, 'BrokenPipeError': <class 'BrokenPipeError'>, 'UnicodeDecodeError': <class 'UnicodeDecodeError'>, 'ArithmeticError': <class 'ArithmeticError'>, 'InterruptedError': <class 'InterruptedError'>, 'any': <built-in function any>, 'delattr': <built-in function delattr>, 'round': <built-in function round>, 'FloatingPointError': <class 'FloatingPointError'>, 'input': <built-in function input>, 'staticmethod': <class 'staticmethod'>, 'help': Type help() for interactive help, or help(object) for help about object., 'UnicodeEncodeError': <class 'UnicodeEncodeError'>, 'UnicodeError': <class 'UnicodeError'>, 'property': <class 'property'>, 'exec': <built-in function exec>, 'TypeError': <class 'TypeError'>, 'range': <class 'range'>, 'int': <class 'int'>, 'IOError': <class 'OSError'>, 'slice': <class 'slice'>, 'PendingDeprecationWarning': <class 'PendingDeprecationWarning'>, 'BlockingIOError': <class 'BlockingIOError'>, 'None': None, 'PermissionError': <class 'PermissionError'>, 'Exception': <class 'Exception'>, 'bytearray': <class 'bytearray'>, 'ConnectionRefusedError': <class 'ConnectionRefusedError'>, 'repr': <built-in function repr>, 'super': <class 'super'>, 'dict': <class 'dict'>, 'zip': <class 'zip'>, 'tuple': <class 'tuple'>, 'bin': <built-in function bin>, 'next': <built-in function next>, 'id': <built-in function id>, 'sum': <built-in function sum>, 'pow': <built-in function pow>, 'BufferError': <class 'BufferError'>, 'list': <class 'list'>, 'reversed': <class 'reversed'>, 'set': <class 'set'>}
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> __cached__
D:\Python\Python35\lib\__pycache__\site.cpython-35.pyc
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> __doc__
Append module search paths for third-party packages to sys.path. ****************************************************************
* This module is automatically imported during initialization. *
**************************************************************** This will append site-specific paths to the module search path. On
Unix (including Mac OSX), it starts with sys.prefix and
sys.exec_prefix (if different) and appends
lib/python<version>/site-packages.
On other platforms (such as Windows), it tries each of the
prefixes directly, as well as with lib/site-packages appended. The
resulting directories, if they exist, are appended to sys.path, and
also inspected for path configuration files. If a file named "pyvenv.cfg" exists one directory above sys.executable,
sys.prefix and sys.exec_prefix are set to that directory and
it is also checked for site-packages (sys.base_prefix and
sys.base_exec_prefix will always be the "real" prefixes of the Python
installation). If "pyvenv.cfg" (a bootstrap configuration file) contains
the key "include-system-site-packages" set to anything other than "false"
(case-insensitive), the system-level prefixes will still also be
searched for site-packages; otherwise they won't. All of the resulting site-specific directories, if they exist, are
appended to sys.path, and also inspected for path configuration
files. A path configuration file is a file whose name has the form
<package>.pth; its contents are additional directories (one per line)
to be added to sys.path. Non-existing directories (or
non-directories) are never added to sys.path; no directory is added to
sys.path more than once. Blank lines and lines beginning with
'#' are skipped. Lines starting with 'import' are executed. For example, suppose sys.prefix and sys.exec_prefix are set to
/usr/local and there is a directory /usr/local/lib/python2.5/site-packages
with three subdirectories, foo, bar and spam, and two path
configuration files, foo.pth and bar.pth. Assume foo.pth contains the
following: # foo package configuration
foo
bar
bletch and bar.pth contains: # bar package configuration
bar Then the following directories are added to sys.path, in this order: /usr/local/lib/python2.5/site-packages/bar
/usr/local/lib/python2.5/site-packages/foo Note that bletch is omitted because it doesn't exist; bar precedes foo
because bar.pth comes alphabetically before foo.pth; and spam is
omitted because it is not mentioned in either path configuration file. The readline module is also automatically configured to enable
completion for systems that support it. This can be overriden in
sitecustomize, usercustomize or PYTHONSTARTUP. After these operations, an attempt is made to import a module
named sitecustomize, which can perform arbitrary additional
site-specific customizations. If this import fails with an
ImportError exception, it is silently ignored. <module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> __file__
D:\Python\Python35\lib\site.py
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> __loader__
<_frozen_importlib_external.SourceFileLoader object at 0x000001E303536B70>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> __name__
site
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> __package__ <module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> __spec__
ModuleSpec(name='site', loader=<_frozen_importlib_external.SourceFileLoader object at 0x000001E303536B70>, origin='D:\\Python\\Python35\\lib\\site.py')
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> _init_pathinfo
<function _init_pathinfo at 0x000001E303985268>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> _script
<function _script at 0x000001E303ADA1E0>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> _sitebuiltins
<module '_sitebuiltins' from 'D:\\Python\\Python35\\lib\\_sitebuiltins.py'>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> abs_paths
<function abs_paths at 0x000001E303975C80>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> addpackage
<function addpackage at 0x000001E3039852F0>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> addsitedir
<function addsitedir at 0x000001E303985378>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> addsitepackages
<function addsitepackages at 0x000001E3039856A8>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> addusersitepackages
<function addusersitepackages at 0x000001E303985598>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> aliasmbcs
<function aliasmbcs at 0x000001E303985950>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> builtins
<module 'builtins' (built-in)>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> check_enableusersite
<function check_enableusersite at 0x000001E303985400>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> enablerlcompleter
<function enablerlcompleter at 0x000001E3039858C8>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> execsitecustomize
<function execsitecustomize at 0x000001E303985A60>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> execusercustomize
<function execusercustomize at 0x000001E303985AE8>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> getsitepackages
<function getsitepackages at 0x000001E303985620>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> getuserbase
<function getuserbase at 0x000001E303985488>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> getusersitepackages
<function getusersitepackages at 0x000001E303985510>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> main
<function main at 0x000001E303985B70>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> makepath
<function makepath at 0x000001E30353E730>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> os
<module 'os' from 'D:\\Python\\Python35\\lib\\os.py'>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> removeduppaths
<function removeduppaths at 0x000001E3039851E0>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> setcopyright
<function setcopyright at 0x000001E3039857B8>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> sethelper
<function sethelper at 0x000001E303985840>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> setquit
<function setquit at 0x000001E303985730>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> sys
<module 'sys' (built-in)>
<module 'site' from 'D:\\Python\\Python35\\lib\\site.py'> venv
<function venv at 0x000001E3039859D8> Process finished with exit code 0

pythontips(1):打印模块的属性并执行的更多相关文章

  1. openerp模块收藏 基于Lodop的报表打印模块(转载)

    基于Lodop的报表打印模块 原文:http://shine-it.net/index.php/topic,7397.0.html 前段时间写了个小模块,来解决OE中报表打印不方便的问题.借鉴了 @b ...

  2. python中string模块各属性以及函数的用法

    任何语言都离不开字符,那就会涉及对字符的操作,尤其是脚本语言更是频繁,不管是生产环境还是面试考验都要面对字符串的操作.     python的字符串操作通过2部分的方法函数基本上就可以解决所有的字符串 ...

  3. Python3学习之路~9.1 paramiko模块:实现ssh执行命令以及传输文件

    我们一般使用linux的时候,都是在Windows上安装一个ssh客户端连接上去.那么从一台linux如何连接到另一条linux呢?使用ssh命令即可,因为每台linux机器自己都有一个ssh客户端. ...

  4. 当更新user表时,页面没有的属性,执行update语句不会更改以前的值

    当更新user表时,页面没有的属性,执行update语句不会更改数据库表的值.不会用NULL值去填充

  5. seajs模块加载与执行原理小记

    本文仅讨论具名模块的情况,即通过spm打包出来的模块. 想起ID与路径统一原则,详见https://github.com/seajs/seajs/issues/930 今天又研究了下seajs源码,源 ...

  6. (转)logback 打印Mybitis中的sql执行过程

    场景:在程序开发过程中经常需要跟踪程序中sql语句的执行过程,在控制台打印出sql语句和对应的参数传递就能够更快的定位错误! 原文出处:http://www.cnblogs.com/beiyeren/ ...

  7. OS模块的补充使用---执行终端命令

    Python基础至os模块 由于近期的项目需要用到对应的终端命令去调用其他程序,因此温习一下os.system()函数: 参考文献:https://zhuanlan.zhihu.com/p/51716 ...

  8. 天津政府应急系统之GIS一张图(arcgis api for flex)讲解(七)地图打印模块

    config.xml文件的配置如下: <widget label="地图打印" icon="assets/images/map_print.png" co ...

  9. Node.js process 模块常用属性和方法

    Node.js是常用的Javascript运行环境,本文和大家发分享的主要是Node.js中process 模块的常用属性和方法,希望通过本文的分享,对大家学习Node.js http://www.m ...

随机推荐

  1. 3771: Triple

    3771: Triple 链接 题意 n个斧头,每个斧头的价值都不同(开始时没注意到),可以取1个,2个,3个斧头组成不同的价值,求每种价值有多少种组成方案(顺序不同算一种) 分析: 生成函数 + 容 ...

  2. Android 布局错乱 Android花屏

    最近做项目,妈的,有个一个很难受的bug. 这个bug ,自己这里没有手机,没有办法复现,找到了手机之后.解决了. 我先给大家看下什么叫布局错乱,花屏: 来张正常的图片: 正常情况下是这样的.然后, ...

  3. BF算法(蛮力匹配算法)

    将主串M指定位置和目标串S开始位置进行对比,如果相同将M的下一个字符和S的下一个字符对比,如果不同则M的下一个字符和S的开始位置对比,直到S中每一个字符和M中的连续字符串相等,否则不匹配. C#代码- ...

  4. python 三目运算

    python中的三目运算: result = a if condition else b #当满足condition返回a否则返回b 三目运算可以使你的代码看起来简洁,且运算高效

  5. STL之deque使用简介

    deque函数列表 函数 c.assign(beg,end)c.assign(n,elem) c.at(idx) c.back() c.begin() c.clear() deque<Elem& ...

  6. MVC学习笔记---WebViewPage(nop等开源项目的@T)

    http://www.cnblogs.com/gyche/p/5597491.html http://www.cnblogs.com/Alex80/p/5369042.html http://www. ...

  7. RabbitMQ vhost 配置

    RabbitMQ vhost 配置 rabbitmqctl set_vhost_limits是用来定义虚拟主机限制的命令 配置最大连接限制 要限制vhost vhost_name中并发客户端连接的 总 ...

  8. 在nodejs中 Object的toString()方法 querystring的stringify() JSON.stringify()

    刚学nodejs,做到一个例子:发送简单的HTTP请求.遇到一个问题,客户端给服务端发送的消息到服务端,服务端收不到消息,确切的说是“”. 以下是服务端代码:server.js const http ...

  9. Spark on Yarn——spark1.5.1集群配置

    写在前面: spark只是一种计算框架,如果要搭建集群要依托与一定的组织模式. 目前来说,Spark集群的组织形式有三种: 1.      Standalone:使用akka作为网络IO组件,mast ...

  10. GYM - 101147 J.Whistle's New Car

    题意: 给出一颗有点权和边权的树.求每一个点u的子树中有多少点v,使得点v到点u的距离小于等于点v的权值. 题解: 对于每一个点,倍增的预处理出他的祖宗节点及距离.根据预处理的结果求出每个点能到的最远 ...