內建類別 :: sys
列出執行環境的作業系統
import sys
sys.plaform
'darwin'
列出命令列引數
import sys
sys.argv
['']
列出 python home
import sys
sys.prefix
'/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5'
列出 python module loading path
import sys
sys.path
['', '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python35.zip', '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5', '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/plat-darwin', '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/lib-dynload', '/usr/local/lib/python3.5/site-packages']
列出可用的模組
import sys
sys.modules
{'_signal': <module '_signal' (built-in)>, 'encodings.utf_8': <module 'encodings.utf_8' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/encodings/utf_8.py'>, 'sysconfig': <module 'sysconfig' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/sysconfig.py'>, '_bootlocale': <module '_bootlocale' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/_bootlocale.py'>, '_frozen_importlib_external': <module '_frozen_importlib_external' (frozen)>, 'encodings': <module 'encodings' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/encodings/__init__.py'>, '_io': <module 'io' (built-in)>, 'io': <module 'io' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/io.py'>, 'errno': <module 'errno' (built-in)>, 'genericpath': <module 'genericpath' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/genericpath.py'>, 'encodings.aliases': <module 'encodings.aliases' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/encodings/aliases.py'>, 'abc': <module 'abc' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/abc.py'>, 'sre_constants': <module 'sre_constants' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/sre_constants.py'>, '_warnings': <module '_warnings' (built-in)>, '_thread': <module '_thread' (built-in)>, 'rlcompleter': <module 'rlcompleter' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/rlcompleter.py'>, '_locale': <module '_locale' (built-in)>, 'posixpath': <module 'posixpath' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/posixpath.py'>, '_weakrefset': <module '_weakrefset' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/_weakrefset.py'>, 'os.path': <module 'posixpath' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/posixpath.py'>, 'encodings.latin_1': <module 'encodings.latin_1' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/encodings/latin_1.py'>, 'sys': <module 'sys' (built-in)>, 'site': <module 'site' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site.py'>, '_sitebuiltins': <module '_sitebuiltins' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/_sitebuiltins.py'>, '_sysconfigdata': <module '_sysconfigdata' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/_sysconfigdata.py'>, 'marshal': <module 'marshal' (built-in)>, '_imp': <module '_imp' (built-in)>, 'copyreg': <module 'copyreg' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/copyreg.py'>, 're': <module 're' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/re.py'>, 'readline': <module 'readline' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/lib-dynload/readline.cpython-35m-darwin.so'>, '_stat': <module '_stat' (built-in)>, 'codecs': <module 'codecs' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/codecs.py'>, 'stat': <module 'stat' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/stat.py'>, 'builtins': <module 'builtins' (built-in)>, 'atexit': <module 'atexit' (built-in)>, 'sre_compile': <module 'sre_compile' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/sre_compile.py'>, '_osx_support': <module '_osx_support' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/_osx_support.py'>, 'os': <module 'os' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/os.py'>, '_weakref': <module '_weakref' (built-in)>, '__main__': <module '__main__' (built-in)>, 'sre_parse': <module 'sre_parse' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/sre_parse.py'>, '_sre': <module '_sre' (built-in)>, 'sitecustomize': <module 'sitecustomize' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/sitecustomize.py'>, 'zipimport': <module 'zipimport' (built-in)>, 'posix': <module 'posix' (built-in)>, '_codecs': <module '_codecs' (built-in)>, '_collections_abc': <module '_collections_abc' from '/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/_collections_abc.py'>, '_frozen_importlib': <module '_frozen_importlib' (frozen)>}
終止程式
import sys
sys.exit(0)