Python相当于phpinfo()的函数
简单来说,有没有一个和PHP的 phpinfo();
功能相似的Python命令?如果有的话,它是什么,怎么用?(如果能给个参考链接就更好了)。
5 个回答
2
没有什么东西能直接和 phpinfo()
相提并论,但你可以获取一些信息 ...
>>> import sys
>>> sys.version
'2.6.4 (r264:75706, Feb 6 2010, 01:49:44) \n[GCC 4.2.1 (Apple Inc. build 5646)]'
>>> sys.platform
'darwin'
>>> sys.modules.keys()
['copy_reg', 'sre_compile', '_sre', 'encodings', 'site', ... ]
>>> import os
>>> os.name
'posix'
>>> import platform
>>> platform.architecture()
('32bit', '')
>>> platform.machine()
'i386'
...
5
看看这个!
pyinfo() 是一个看起来很不错的类似 phpinfo 的 Python 脚本
2023 更新: 这个脚本已经移到 Gist 上了,
更重要的是: 有位评论者让它兼容 Python 3 了