Python sys 模块简介

sys 简介

“sys” 即 “system”,“系统”之意。该模块提供了一些接口,用于访问 Python 解释器自身使用和维护的变量,同时模块中还提供了一部分函数,可以与解释器进行比较深度的交互。

常用变量

sys.version

返回Python解析器版本号

import sys
print(sys.version)
#3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)]

sys.maxsize

操作系统所能承载的最大int值

print(sys.maxsize)
#9223372036854775807

sys.maxunicode

最大的unicode值

print(sys.maxunicode)
#1114111

sys.path

当前脚本的path环境变量

print(sys.path)
#['E:\\worksp_py\\hardwary\\100day\\thirty', 'E:\\worksp_py\\hardwary', 'D:\\tool\\PyCharm 2020.2.2\\plugins\\python\\helpers\\pycharm_display', 'D:\\tool\\python3.8\\python38.zip', 'D:\\tool\\python3.8\\DLLs', 'D:\\tool\\python3.8\\lib', 'D:\\tool\\python3.8', 'E:\\worksp_py\\hardwary\\venvop', 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages', 'D:\\tool\\PyCharm 2020.2.2\\plugins\\python\\helpers\\pycharm_matplotlib_backend']

sys.platform

返回操作系统平台名称

print(sys.platform)
#win32

linux 返回 linux,Mac 返回 darwin

sys.args

运行脚本的名称以及所需的参数列表作为 list

import sys

print(sys.argv)

sys.executable

 Python 解析器的绝对路径

E:\worksp_py\hardwary\venvop\Scripts\python.exe

 

常用方法

sys.exit()

退出程序

print(sys.exit(0))
print(sys.exit(1))

sys.modules

返回系统导入的模块信息

print(sys.modules)
#{'sys': <module 'sys' (built-in)>, 'builtins': <module 'builtins' (built-in)>, '_frozen_importlib': <module 'importlib._bootstrap' (frozen)>, '_imp': <module '_imp' (built-in)>, '_warnings': <module '_warnings' (built-in)>, '_frozen_importlib_external': <module 'importlib._bootstrap_external' (frozen)>, '_io': <module 'io' (built-in)>, 'marshal': <module 'marshal' (built-in)>, 'nt': <module 'nt' (built-in)>, '_thread': <module '_thread' (built-in)>, '_weakref': <module '_weakref' (built-in)>, 'winreg': <module 'winreg' (built-in)>, 'time': <module 'time' (built-in)>, 'zipimport': <module 'zipimport' (frozen)>, '_codecs': <module '_codecs' (built-in)>, 'codecs': <module 'codecs' from 'D:\\tool\\python3.8\\lib\\codecs.py'>, 'encodings.aliases': <module 'encodings.aliases' from 'D:\\tool\\python3.8\\lib\\encodings\\aliases.py'>, 'encodings': <module 'encodings' from 'D:\\tool\\python3.8\\lib\\encodings\\__init__.py'>, 'encodings.utf_8': <module 'encodings.utf_8' from 'D:\\tool\\python3.8\\lib\\encodings\\utf_8.py'>, '_signal': <module '_signal' (built-in)>, '__main__': <module '__main__' from 'E:/worksp_py/hardwary/100day/thirty/sysTest.py'>, 'encodings.latin_1': <module 'encodings.latin_1' from 'D:\\tool\\python3.8\\lib\\encodings\\latin_1.py'>, '_abc': <module '_abc' (built-in)>, 'abc': <module 'abc' from 'D:\\tool\\python3.8\\lib\\abc.py'>, 'io': <module 'io' from 'D:\\tool\\python3.8\\lib\\io.py'>, '_stat': <module '_stat' (built-in)>, 'stat': <module 'stat' from 'D:\\tool\\python3.8\\lib\\stat.py'>, 'genericpath': <module 'genericpath' from 'D:\\tool\\python3.8\\lib\\genericpath.py'>, 'ntpath': <module 'ntpath' from 'D:\\tool\\python3.8\\lib\\ntpath.py'>, 'os.path': <module 'ntpath' from 'D:\\tool\\python3.8\\lib\\ntpath.py'>, '_collections_abc': <module '_collections_abc' from 'D:\\tool\\python3.8\\lib\\_collections_abc.py'>, 'os': <module 'os' from 'D:\\tool\\python3.8\\lib\\os.py'>, '_sitebuiltins': <module '_sitebuiltins' from 'D:\\tool\\python3.8\\lib\\_sitebuiltins.py'>, '_locale': <module '_locale' (built-in)>, '_bootlocale': <module '_bootlocale' from 'D:\\tool\\python3.8\\lib\\_bootlocale.py'>, '_codecs_cn': <module '_codecs_cn' (built-in)>, '_multibytecodec': <module '_multibytecodec' (built-in)>, 'encodings.gbk': <module 'encodings.gbk' from 'D:\\tool\\python3.8\\lib\\encodings\\gbk.py'>, '_distutils_hack': <module '_distutils_hack' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\_distutils_hack\\__init__.py'>, 'types': <module 'types' from 'D:\\tool\\python3.8\\lib\\types.py'>, 'importlib._bootstrap': <module 'importlib._bootstrap' (frozen)>, 'importlib._bootstrap_external': <module 'importlib._bootstrap_external' (frozen)>, 'warnings': <module 'warnings' from 'D:\\tool\\python3.8\\lib\\warnings.py'>, 'importlib': <module 'importlib' from 'D:\\tool\\python3.8\\lib\\importlib\\__init__.py'>, 'importlib.machinery': <module 'importlib.machinery' from 'D:\\tool\\python3.8\\lib\\importlib\\machinery.py'>, 'importlib.abc': <module 'importlib.abc' from 'D:\\tool\\python3.8\\lib\\importlib\\abc.py'>, '_operator': <module '_operator' (built-in)>, 'operator': <module 'operator' from 'D:\\tool\\python3.8\\lib\\operator.py'>, 'keyword': <module 'keyword' from 'D:\\tool\\python3.8\\lib\\keyword.py'>, '_heapq': <module '_heapq' (built-in)>, 'heapq': <module 'heapq' from 'D:\\tool\\python3.8\\lib\\heapq.py'>, 'itertools': <module 'itertools' (built-in)>, 'reprlib': <module 'reprlib' from 'D:\\tool\\python3.8\\lib\\reprlib.py'>, '_collections': <module '_collections' (built-in)>, 'collections': <module 'collections' from 'D:\\tool\\python3.8\\lib\\collections\\__init__.py'>, '_functools': <module '_functools' (built-in)>, 'functools': <module 'functools' from 'D:\\tool\\python3.8\\lib\\functools.py'>, 'contextlib': <module 'contextlib' from 'D:\\tool\\python3.8\\lib\\contextlib.py'>, 'importlib.util': <module 'importlib.util' from 'D:\\tool\\python3.8\\lib\\importlib\\util.py'>, 'mpl_toolkits': <module 'mpl_toolkits' (namespace)>, 'enum': <module 'enum' from 'D:\\tool\\python3.8\\lib\\enum.py'>, '_sre': <module '_sre' (built-in)>, 'sre_constants': <module 'sre_constants' from 'D:\\tool\\python3.8\\lib\\sre_constants.py'>, 'sre_parse': <module 'sre_parse' from 'D:\\tool\\python3.8\\lib\\sre_parse.py'>, 'sre_compile': <module 'sre_compile' from 'D:\\tool\\python3.8\\lib\\sre_compile.py'>, 'copyreg': <module 'copyreg' from 'D:\\tool\\python3.8\\lib\\copyreg.py'>, 're': <module 're' from 'D:\\tool\\python3.8\\lib\\re.py'>, 'token': <module 'token' from 'D:\\tool\\python3.8\\lib\\token.py'>, 'tokenize': <module 'tokenize' from 'D:\\tool\\python3.8\\lib\\tokenize.py'>, 'linecache': <module 'linecache' from 'D:\\tool\\python3.8\\lib\\linecache.py'>, 'traceback': <module 'traceback' from 'D:\\tool\\python3.8\\lib\\traceback.py'>, 'atexit': <module 'atexit' (built-in)>, 'collections.abc': <module 'collections.abc' from 'D:\\tool\\python3.8\\lib\\collections\\abc.py'>, '_opcode': <module '_opcode' (built-in)>, 'opcode': <module 'opcode' from 'D:\\tool\\python3.8\\lib\\opcode.py'>, 'dis': <module 'dis' from 'D:\\tool\\python3.8\\lib\\dis.py'>, 'inspect': <module 'inspect' from 'D:\\tool\\python3.8\\lib\\inspect.py'>, 'locale': <module 'locale' from 'D:\\tool\\python3.8\\lib\\locale.py'>, '_weakrefset': <module '_weakrefset' from 'D:\\tool\\python3.8\\lib\\_weakrefset.py'>, 'weakref': <module 'weakref' from 'D:\\tool\\python3.8\\lib\\weakref.py'>, '_string': <module '_string' (built-in)>, 'string': <module 'string' from 'D:\\tool\\python3.8\\lib\\string.py'>, 'threading': <module 'threading' from 'D:\\tool\\python3.8\\lib\\threading.py'>, 'logging': <module 'logging' from 'D:\\tool\\python3.8\\lib\\logging\\__init__.py'>, 'posixpath': <module 'posixpath' from 'D:\\tool\\python3.8\\lib\\posixpath.py'>, 'fnmatch': <module 'fnmatch' from 'D:\\tool\\python3.8\\lib\\fnmatch.py'>, 'errno': <module 'errno' (built-in)>, 'urllib': <module 'urllib' from 'D:\\tool\\python3.8\\lib\\urllib\\__init__.py'>, 'urllib.parse': <module 'urllib.parse' from 'D:\\tool\\python3.8\\lib\\urllib\\parse.py'>, 'pathlib': <module 'pathlib' from 'D:\\tool\\python3.8\\lib\\pathlib.py'>, 'pprint': <module 'pprint' from 'D:\\tool\\python3.8\\lib\\pprint.py'>, 'zlib': <module 'zlib' (built-in)>, '_compression': <module '_compression' from 'D:\\tool\\python3.8\\lib\\_compression.py'>, '_bz2': <module '_bz2' from 'D:\\tool\\python3.8\\DLLs\\_bz2.pyd'>, 'bz2': <module 'bz2' from 'D:\\tool\\python3.8\\lib\\bz2.py'>, '_lzma': <module '_lzma' from 'D:\\tool\\python3.8\\DLLs\\_lzma.pyd'>, 'lzma': <module 'lzma' from 'D:\\tool\\python3.8\\lib\\lzma.py'>, 'shutil': <module 'shutil' from 'D:\\tool\\python3.8\\lib\\shutil.py'>, 'signal': <module 'signal' from 'D:\\tool\\python3.8\\lib\\signal.py'>, 'msvcrt': <module 'msvcrt' (built-in)>, '_winapi': <module '_winapi' (built-in)>, 'subprocess': <module 'subprocess' from 'D:\\tool\\python3.8\\lib\\subprocess.py'>, 'math': <module 'math' (built-in)>, '_bisect': <module '_bisect' (built-in)>, 'bisect': <module 'bisect' from 'D:\\tool\\python3.8\\lib\\bisect.py'>, '_sha512': <module '_sha512' (built-in)>, '_random': <module '_random' (built-in)>, 'random': <module 'random' from 'D:\\tool\\python3.8\\lib\\random.py'>, 'tempfile': <module 'tempfile' from 'D:\\tool\\python3.8\\lib\\tempfile.py'>, 'numpy._globals': <module 'numpy._globals' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\_globals.py'>, 'numpy.__config__': <module 'numpy.__config__' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\__config__.py'>, 'glob': <module 'glob' from 'D:\\tool\\python3.8\\lib\\glob.py'>, '_ctypes': <module '_ctypes' from 'D:\\tool\\python3.8\\DLLs\\_ctypes.pyd'>, '_struct': <module '_struct' (built-in)>, 'struct': <module 'struct' from 'D:\\tool\\python3.8\\lib\\struct.py'>, 'ctypes._endian': <module 'ctypes._endian' from 'D:\\tool\\python3.8\\lib\\ctypes\\_endian.py'>, 'ctypes': <module 'ctypes' from 'D:\\tool\\python3.8\\lib\\ctypes\\__init__.py'>, 'numpy._distributor_init': <module 'numpy._distributor_init' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\_distributor_init.py'>, '__future__': <module '__future__' from 'D:\\tool\\python3.8\\lib\\__future__.py'>, '_json': <module '_json' (built-in)>, 'json.scanner': <module 'json.scanner' from 'D:\\tool\\python3.8\\lib\\json\\scanner.py'>, 'json.decoder': <module 'json.decoder' from 'D:\\tool\\python3.8\\lib\\json\\decoder.py'>, 'json.encoder': <module 'json.encoder' from 'D:\\tool\\python3.8\\lib\\json\\encoder.py'>, 'json': <module 'json' from 'D:\\tool\\python3.8\\lib\\json\\__init__.py'>, 'numpy._version': <module 'numpy._version' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\_version.py'>, 'numpy.version': <module 'numpy.version' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\version.py'>, '_datetime': <module '_datetime' (built-in)>, 'datetime': <module 'datetime' from 'D:\\tool\\python3.8\\lib\\datetime.py'>, 'numpy.core._multiarray_umath': <module 'numpy.core._multiarray_umath' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\_multiarray_umath.cp38-win_amd64.pyd'>, 'numpy.compat._inspect': <module 'numpy.compat._inspect' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\compat\\_inspect.py'>, 'numpy.compat._pep440': <module 'numpy.compat._pep440' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\compat\\_pep440.py'>, '_compat_pickle': <module '_compat_pickle' from 'D:\\tool\\python3.8\\lib\\_compat_pickle.py'>, '_pickle': <module '_pickle' (built-in)>, 'pickle': <module 'pickle' from 'D:\\tool\\python3.8\\lib\\pickle.py'>, 'numpy.compat.py3k': <module 'numpy.compat.py3k' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\compat\\py3k.py'>, 'numpy.compat': <module 'numpy.compat' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\compat\\__init__.py'>, 'numpy.core.overrides': <module 'numpy.core.overrides' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\overrides.py'>, 'numpy.core.multiarray': <module 'numpy.core.multiarray' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\multiarray.py'>, 'numpy.core.umath': <module 'numpy.core.umath' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\umath.py'>, 'numbers': <module 'numbers' from 'D:\\tool\\python3.8\\lib\\numbers.py'>, 'numpy.core._string_helpers': <module 'numpy.core._string_helpers' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\_string_helpers.py'>, 'numpy.core._dtype': <module 'numpy.core._dtype' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\_dtype.py'>, 'numpy.core._type_aliases': <module 'numpy.core._type_aliases' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\_type_aliases.py'>, 'numpy.core.numerictypes': <module 'numpy.core.numerictypes' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\numerictypes.py'>, 'numpy.core._exceptions': <module 'numpy.core._exceptions' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\_exceptions.py'>, 'numpy.core._methods': <module 'numpy.core._methods' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\_methods.py'>, 'numpy.core.fromnumeric': <module 'numpy.core.fromnumeric' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\fromnumeric.py'>, 'numpy.core.shape_base': <module 'numpy.core.shape_base' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\shape_base.py'>, 'numpy.core._ufunc_config': <module 'numpy.core._ufunc_config' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\_ufunc_config.py'>, 'numpy.core.arrayprint': <module 'numpy.core.arrayprint' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\arrayprint.py'>, 'numpy.core._asarray': <module 'numpy.core._asarray' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\_asarray.py'>, 'numpy.core.numeric': <module 'numpy.core.numeric' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\numeric.py'>, 'numpy.core.defchararray': <module 'numpy.core.defchararray' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\defchararray.py'>, 'numpy.core.records': <module 'numpy.core.records' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\records.py'>, 'numpy.core.memmap': <module 'numpy.core.memmap' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\memmap.py'>, 'numpy.core.function_base': <module 'numpy.core.function_base' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\function_base.py'>, 'numpy.core._machar': <module 'numpy.core._machar' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\_machar.py'>, 'numpy.core.getlimits': <module 'numpy.core.getlimits' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\getlimits.py'>, 'numpy.core.einsumfunc': <module 'numpy.core.einsumfunc' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\einsumfunc.py'>, 'numpy.core._multiarray_tests': <module 'numpy.core._multiarray_tests' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\_multiarray_tests.cp38-win_amd64.pyd'>, 'numpy.core._add_newdocs': <module 'numpy.core._add_newdocs' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\_add_newdocs.py'>, 'platform': <module 'platform' from 'D:\\tool\\python3.8\\lib\\platform.py'>, '_socket': <module '_socket' from 'D:\\tool\\python3.8\\DLLs\\_socket.pyd'>, 'select': <module 'select' from 'D:\\tool\\python3.8\\DLLs\\select.pyd'>, 'selectors': <module 'selectors' from 'D:\\tool\\python3.8\\lib\\selectors.py'>, 'socket': <module 'socket' from 'D:\\tool\\python3.8\\lib\\socket.py'>, 'numpy.core._add_newdocs_scalars': <module 'numpy.core._add_newdocs_scalars' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\_add_newdocs_scalars.py'>, 'numpy.core._dtype_ctypes': <module 'numpy.core._dtype_ctypes' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\_dtype_ctypes.py'>, '_ast': <module '_ast' (built-in)>, 'ast': <module 'ast' from 'D:\\tool\\python3.8\\lib\\ast.py'>, 'numpy.core._internal': <module 'numpy.core._internal' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\_internal.py'>, 'numpy._pytesttester': <module 'numpy._pytesttester' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\_pytesttester.py'>, 'numpy.core': <module 'numpy.core' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\core\\__init__.py'>, 'numpy.lib.mixins': <module 'numpy.lib.mixins' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\lib\\mixins.py'>, 'numpy.lib.ufunclike': <module 'numpy.lib.ufunclike' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\lib\\ufunclike.py'>, 'numpy.lib.type_check': <module 'numpy.lib.type_check' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\lib\\type_check.py'>, 'numpy.lib.scimath': <module 'numpy.lib.scimath' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\lib\\scimath.py'>, 'numpy.lib.stride_tricks': <module 'numpy.lib.stride_tricks' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\lib\\stride_tricks.py'>, 'numpy.lib.twodim_base': <module 'numpy.lib.twodim_base' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\lib\\twodim_base.py'>, 'numpy.linalg._umath_linalg': <module 'numpy.linalg._umath_linalg' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\linalg\\_umath_linalg.cp38-win_amd64.pyd'>, 'numpy.linalg.linalg': <module 'numpy.linalg.linalg' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\linalg\\linalg.py'>, 'numpy.linalg': <module 'numpy.linalg' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\linalg\\__init__.py'>, 'numpy.matrixlib.defmatrix': <module 'numpy.matrixlib.defmatrix' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\matrixlib\\defmatrix.py'>, 'numpy.matrixlib': <module 'numpy.matrixlib' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\matrixlib\\__init__.py'>, 'numpy.lib.histograms': <module 'numpy.lib.histograms' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\lib\\histograms.py'>, 'numpy.lib.function_base': <module 'numpy.lib.function_base' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\lib\\function_base.py'>, 'numpy.lib.index_tricks': <module 'numpy.lib.index_tricks' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\lib\\index_tricks.py'>, 'numpy.lib.nanfunctions': <module 'numpy.lib.nanfunctions' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\lib\\nanfunctions.py'>, 'numpy.lib.shape_base': <module 'numpy.lib.shape_base' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\lib\\shape_base.py'>, 'numpy.lib.polynomial': <module 'numpy.lib.polynomial' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\lib\\polynomial.py'>, 'textwrap': <module 'textwrap' from 'D:\\tool\\python3.8\\lib\\textwrap.py'>, 'numpy.lib.utils': <module 'numpy.lib.utils' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\lib\\utils.py'>, 'numpy.lib.arraysetops': <module 'numpy.lib.arraysetops' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\lib\\arraysetops.py'>, 'numpy.lib.format': <module 'numpy.lib.format' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\lib\\format.py'>, 'numpy.lib._datasource': <module 'numpy.lib._datasource' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\lib\\_datasource.py'>, 'numpy.lib._iotools': <module 'numpy.lib._iotools' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\lib\\_iotools.py'>, 'numpy.lib.npyio': <module 'numpy.lib.npyio' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\lib\\npyio.py'>, 'numpy.lib.arrayterator': <module 'numpy.lib.arrayterator' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\lib\\arrayterator.py'>, 'numpy.lib.arraypad': <module 'numpy.lib.arraypad' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\lib\\arraypad.py'>, 'numpy.lib._version': <module 'numpy.lib._version' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\lib\\_version.py'>, 'numpy.lib': <module 'numpy.lib' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\lib\\__init__.py'>, 'numpy.fft._pocketfft_internal': <module 'numpy.fft._pocketfft_internal' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\fft\\_pocketfft_internal.cp38-win_amd64.pyd'>, 'numpy.fft._pocketfft': <module 'numpy.fft._pocketfft' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\fft\\_pocketfft.py'>, 'numpy.fft.helper': <module 'numpy.fft.helper' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\fft\\helper.py'>, 'numpy.fft': <module 'numpy.fft' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\fft\\__init__.py'>, 'numpy.polynomial.polyutils': <module 'numpy.polynomial.polyutils' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\polynomial\\polyutils.py'>, 'numpy.polynomial._polybase': <module 'numpy.polynomial._polybase' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\polynomial\\_polybase.py'>, 'numpy.polynomial.polynomial': <module 'numpy.polynomial.polynomial' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\polynomial\\polynomial.py'>, 'numpy.polynomial.chebyshev': <module 'numpy.polynomial.chebyshev' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\polynomial\\chebyshev.py'>, 'numpy.polynomial.legendre': <module 'numpy.polynomial.legendre' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\polynomial\\legendre.py'>, 'numpy.polynomial.hermite': <module 'numpy.polynomial.hermite' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\polynomial\\hermite.py'>, 'numpy.polynomial.hermite_e': <module 'numpy.polynomial.hermite_e' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\polynomial\\hermite_e.py'>, 'numpy.polynomial.laguerre': <module 'numpy.polynomial.laguerre' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\polynomial\\laguerre.py'>, 'numpy.polynomial': <module 'numpy.polynomial' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\polynomial\\__init__.py'>, 'cython_runtime': <module 'cython_runtime'>, '_cython_0_29_30': <module '_cython_0_29_30'>, 'numpy.random._common': <module 'numpy.random._common' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\random\\_common.cp38-win_amd64.pyd'>, 'binascii': <module 'binascii' (built-in)>, 'base64': <module 'base64' from 'D:\\tool\\python3.8\\lib\\base64.py'>, '_hashlib': <module '_hashlib' from 'D:\\tool\\python3.8\\DLLs\\_hashlib.pyd'>, '_blake2': <module '_blake2' (built-in)>, '_sha3': <module '_sha3' (built-in)>, 'hashlib': <module 'hashlib' from 'D:\\tool\\python3.8\\lib\\hashlib.py'>, 'hmac': <module 'hmac' from 'D:\\tool\\python3.8\\lib\\hmac.py'>, 'secrets': <module 'secrets' from 'D:\\tool\\python3.8\\lib\\secrets.py'>, 'numpy.random.bit_generator': <module 'numpy.random.bit_generator' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\random\\bit_generator.cp38-win_amd64.pyd'>, 'numpy.random._bounded_integers': <module 'numpy.random._bounded_integers' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\random\\_bounded_integers.cp38-win_amd64.pyd'>, 'numpy.random._mt19937': <module 'numpy.random._mt19937' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\random\\_mt19937.cp38-win_amd64.pyd'>, 'numpy.random.mtrand': <module 'numpy.random.mtrand' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\random\\mtrand.cp38-win_amd64.pyd'>, 'numpy.random._philox': <module 'numpy.random._philox' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\random\\_philox.cp38-win_amd64.pyd'>, 'numpy.random._pcg64': <module 'numpy.random._pcg64' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\random\\_pcg64.cp38-win_amd64.pyd'>, 'numpy.random._sfc64': <module 'numpy.random._sfc64' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\random\\_sfc64.cp38-win_amd64.pyd'>, 'numpy.random._generator': <module 'numpy.random._generator' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\random\\_generator.cp38-win_amd64.pyd'>, 'numpy.random._pickle': <module 'numpy.random._pickle' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\random\\_pickle.py'>, 'numpy.random': <module 'numpy.random' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\random\\__init__.py'>, 'numpy.ctypeslib': <module 'numpy.ctypeslib' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\ctypeslib.py'>, 'numpy.ma.core': <module 'numpy.ma.core' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\ma\\core.py'>, 'numpy.ma.extras': <module 'numpy.ma.extras' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\ma\\extras.py'>, 'numpy.ma': <module 'numpy.ma' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\ma\\__init__.py'>, 'numpy': <module 'numpy' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\numpy\\__init__.py'>, 'packaging.__about__': <module 'packaging.__about__' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\packaging\\__about__.py'>, 'packaging': <module 'packaging' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\packaging\\__init__.py'>, 'typing.io': <class 'typing.io'>, 'typing.re': <class 'typing.re'>, 'typing': <module 'typing' from 'D:\\tool\\python3.8\\lib\\typing.py'>, 'packaging._structures': <module 'packaging._structures' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\packaging\\_structures.py'>, 'packaging.version': <module 'packaging.version' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\packaging\\version.py'>, 'matplotlib._api.deprecation': <module 'matplotlib._api.deprecation' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\matplotlib\\_api\\deprecation.py'>, 'matplotlib._api': <module 'matplotlib._api' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\matplotlib\\_api\\__init__.py'>, 'matplotlib._version': <module 'matplotlib._version' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\matplotlib\\_version.py'>, 'gzip': <module 'gzip' from 'D:\\tool\\python3.8\\lib\\gzip.py'>, 'shlex': <module 'shlex' from 'D:\\tool\\python3.8\\lib\\shlex.py'>, 'matplotlib._c_internal_utils': <module 'matplotlib._c_internal_utils' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\matplotlib\\_c_internal_utils.cp38-win_amd64.pyd'>, 'matplotlib.cbook': <module 'matplotlib.cbook' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\matplotlib\\cbook\\__init__.py'>, 'matplotlib.docstring': <module 'matplotlib.docstring' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\matplotlib\\docstring.py'>, 'copy': <module 'copy' from 'D:\\tool\\python3.8\\lib\\copy.py'>, 'PIL._version': <module 'PIL._version' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\PIL\\_version.py'>, 'PIL': <module 'PIL' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\PIL\\__init__.py'>, 'PIL.ImageMode': <module 'PIL.ImageMode' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\PIL\\ImageMode.py'>, 'PIL.TiffTags': <module 'PIL.TiffTags' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\PIL\\TiffTags.py'>, 'PIL._binary': <module 'PIL._binary' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\PIL\\_binary.py'>, 'PIL._deprecate': <module 'PIL._deprecate' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\PIL\\_deprecate.py'>, 'PIL._util': <module 'PIL._util' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\PIL\\_util.py'>, 'PIL._imaging': <module 'PIL._imaging' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\PIL\\_imaging.cp38-win_amd64.pyd'>, 'PIL.Image': <module 'PIL.Image' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\PIL\\Image.py'>, 'PIL.ImageChops': <module 'PIL.ImageChops' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\PIL\\ImageChops.py'>, 'PIL.ImageFile': <module 'PIL.ImageFile' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\PIL\\ImageFile.py'>, 'array': <module 'array' (built-in)>, 'PIL.GimpGradientFile': <module 'PIL.GimpGradientFile' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\PIL\\GimpGradientFile.py'>, 'PIL.GimpPaletteFile': <module 'PIL.GimpPaletteFile' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\PIL\\GimpPaletteFile.py'>, 'PIL.ImageColor': <module 'PIL.ImageColor' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\PIL\\ImageColor.py'>, 'PIL.PaletteFile': <module 'PIL.PaletteFile' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\PIL\\PaletteFile.py'>, 'PIL.ImagePalette': <module 'PIL.ImagePalette' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\PIL\\ImagePalette.py'>, 'PIL.ImageSequence': <module 'PIL.ImageSequence' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\PIL\\ImageSequence.py'>, 'PIL.PngImagePlugin': <module 'PIL.PngImagePlugin' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\PIL\\PngImagePlugin.py'>, 'matplotlib._path': <module 'matplotlib._path' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\matplotlib\\_path.cp38-win_amd64.pyd'>, 'matplotlib.bezier': <module 'matplotlib.bezier' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\matplotlib\\bezier.py'>, 'matplotlib.path': <module 'matplotlib.path' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\matplotlib\\path.py'>, 'matplotlib.transforms': <module 'matplotlib.transforms' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\matplotlib\\transforms.py'>, 'matplotlib.ticker': <module 'matplotlib.ticker' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\matplotlib\\ticker.py'>, 'matplotlib.scale': <module 'matplotlib.scale' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\matplotlib\\scale.py'>, 'matplotlib._color_data': <module 'matplotlib._color_data' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\matplotlib\\_color_data.py'>, 'matplotlib.colors': <module 'matplotlib.colors' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\matplotlib\\colors.py'>, 'pyparsing.util': <module 'pyparsing.util' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\pyparsing\\util.py'>, 'pyparsing.unicode': <module 'pyparsing.unicode' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\pyparsing\\unicode.py'>, 'pyparsing.exceptions': <module 'pyparsing.exceptions' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\pyparsing\\exceptions.py'>, 'pyparsing.actions': <module 'pyparsing.actions' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\pyparsing\\actions.py'>, 'pyparsing.results': <module 'pyparsing.results' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\pyparsing\\results.py'>, 'pyparsing.core': <module 'pyparsing.core' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\pyparsing\\core.py'>, 'html.entities': <module 'html.entities' from 'D:\\tool\\python3.8\\lib\\html\\entities.py'>, 'html': <module 'html' from 'D:\\tool\\python3.8\\lib\\html\\__init__.py'>, 'pyparsing.helpers': <module 'pyparsing.helpers' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\pyparsing\\helpers.py'>, 'pyparsing.testing': <module 'pyparsing.testing' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\pyparsing\\testing.py'>, 'pyparsing.common': <module 'pyparsing.common' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\pyparsing\\common.py'>, 'pyparsing': <module 'pyparsing' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\pyparsing\\__init__.py'>, 'matplotlib.fontconfig_pattern': <module 'matplotlib.fontconfig_pattern' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\matplotlib\\fontconfig_pattern.py'>, 'matplotlib._enums': <module 'matplotlib._enums' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\matplotlib\\_enums.py'>, 'cycler': <module 'cycler' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\cycler.py'>, 'matplotlib.rcsetup': <module 'matplotlib.rcsetup' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\matplotlib\\rcsetup.py'>, 'matplotlib.ft2font': <module 'matplotlib.ft2font' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\matplotlib\\ft2font.cp38-win_amd64.pyd'>, 'dateutil._version': <module 'dateutil._version' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\dateutil\\_version.py'>, 'dateutil': <module 'dateutil' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\dateutil\\__init__.py'>, 'kiwisolver._cext': <module 'kiwisolver._cext' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\kiwisolver\\_cext.cp38-win_amd64.pyd'>, 'kiwisolver': <module 'kiwisolver' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\kiwisolver\\__init__.py'>, 'matplotlib._cm': <module 'matplotlib._cm' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\matplotlib\\_cm.py'>, 'matplotlib._cm_listed': <module 'matplotlib._cm_listed' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\matplotlib\\_cm_listed.py'>, 'matplotlib.cm': <module 'matplotlib.cm' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\matplotlib\\cm.py'>, 'matplotlib': <module 'matplotlib' from 'E:\\worksp_py\\hardwary\\venvop\\lib\\site-packages\\matplotlib\\__init__.py'>, 'sitecustomize': <module 'sitecustomize' from 'D:\\tool\\PyCharm 2020.2.2\\plugins\\python\\helpers\\pycharm_matplotlib_backend\\sitecustomize.py'>, 'site': <module 'site' from 'D:\\tool\\python3.8\\lib\\site.py'>}

modules.keys())

导入模块名列表

print(sys.modules.keys())
#dict_keys(['sys', 'builtins', '_frozen_importlib', '_imp', '_warnings', '_frozen_importlib_external', '_io', 'marshal', 'nt', '_thread', '_weakref', 'winreg', 'time', 'zipimport', '_codecs', 'codecs', 'encodings.aliases', 'encodings', 'encodings.utf_8', '_signal', '__main__', 'encodings.latin_1', '_abc', 'abc', 'io', '_stat', 'stat', 'genericpath', 'ntpath', 'os.path', '_collections_abc', 'os', '_sitebuiltins', '_locale', '_bootlocale', '_codecs_cn', '_multibytecodec', 'encodings.gbk', '_distutils_hack', 'types', 'importlib._bootstrap', 'importlib._bootstrap_external', 'warnings', 'importlib', 'importlib.machinery', 'importlib.abc', '_operator', 'operator', 'keyword', '_heapq', 'heapq', 'itertools', 'reprlib', '_collections', 'collections', '_functools', 'functools', 'contextlib', 'importlib.util', 'mpl_toolkits', 'enum', '_sre', 'sre_constants', 'sre_parse', 'sre_compile', 'copyreg', 're', 'token', 'tokenize', 'linecache', 'traceback', 'atexit', 'collections.abc', '_opcode', 'opcode', 'dis', 'inspect', 'locale', '_weakrefset', 'weakref', '_string', 'string', 'threading', 'logging', 'posixpath', 'fnmatch', 'errno', 'urllib', 'urllib.parse', 'pathlib', 'pprint', 'zlib', '_compression', '_bz2', 'bz2', '_lzma', 'lzma', 'shutil', 'signal', 'msvcrt', '_winapi', 'subprocess', 'math', '_bisect', 'bisect', '_sha512', '_random', 'random', 'tempfile', 'numpy._globals', 'numpy.__config__', 'glob', '_ctypes', '_struct', 'struct', 'ctypes._endian', 'ctypes', 'numpy._distributor_init', '__future__', '_json', 'json.scanner', 'json.decoder', 'json.encoder', 'json', 'numpy._version', 'numpy.version', '_datetime', 'datetime', 'numpy.core._multiarray_umath', 'numpy.compat._inspect', 'numpy.compat._pep440', '_compat_pickle', '_pickle', 'pickle', 'numpy.compat.py3k', 'numpy.compat', 'numpy.core.overrides', 'numpy.core.multiarray', 'numpy.core.umath', 'numbers', 'numpy.core._string_helpers', 'numpy.core._dtype', 'numpy.core._type_aliases', 'numpy.core.numerictypes', 'numpy.core._exceptions', 'numpy.core._methods', 'numpy.core.fromnumeric', 'numpy.core.shape_base', 'numpy.core._ufunc_config', 'numpy.core.arrayprint', 'numpy.core._asarray', 'numpy.core.numeric', 'numpy.core.defchararray', 'numpy.core.records', 'numpy.core.memmap', 'numpy.core.function_base', 'numpy.core._machar', 'numpy.core.getlimits', 'numpy.core.einsumfunc', 'numpy.core._multiarray_tests', 'numpy.core._add_newdocs', 'platform', '_socket', 'select', 'selectors', 'socket', 'numpy.core._add_newdocs_scalars', 'numpy.core._dtype_ctypes', '_ast', 'ast', 'numpy.core._internal', 'numpy._pytesttester', 'numpy.core', 'numpy.lib.mixins', 'numpy.lib.ufunclike', 'numpy.lib.type_check', 'numpy.lib.scimath', 'numpy.lib.stride_tricks', 'numpy.lib.twodim_base', 'numpy.linalg._umath_linalg', 'numpy.linalg.linalg', 'numpy.linalg', 'numpy.matrixlib.defmatrix', 'numpy.matrixlib', 'numpy.lib.histograms', 'numpy.lib.function_base', 'numpy.lib.index_tricks', 'numpy.lib.nanfunctions', 'numpy.lib.shape_base', 'numpy.lib.polynomial', 'textwrap', 'numpy.lib.utils', 'numpy.lib.arraysetops', 'numpy.lib.format', 'numpy.lib._datasource', 'numpy.lib._iotools', 'numpy.lib.npyio', 'numpy.lib.arrayterator', 'numpy.lib.arraypad', 'numpy.lib._version', 'numpy.lib', 'numpy.fft._pocketfft_internal', 'numpy.fft._pocketfft', 'numpy.fft.helper', 'numpy.fft', 'numpy.polynomial.polyutils', 'numpy.polynomial._polybase', 'numpy.polynomial.polynomial', 'numpy.polynomial.chebyshev', 'numpy.polynomial.legendre', 'numpy.polynomial.hermite', 'numpy.polynomial.hermite_e', 'numpy.polynomial.laguerre', 'numpy.polynomial', 'cython_runtime', '_cython_0_29_30', 'numpy.random._common', 'binascii', 'base64', '_hashlib', '_blake2', '_sha3', 'hashlib', 'hmac', 'secrets', 'numpy.random.bit_generator', 'numpy.random._bounded_integers', 'numpy.random._mt19937', 'numpy.random.mtrand', 'numpy.random._philox', 'numpy.random._pcg64', 'numpy.random._sfc64', 'numpy.random._generator', 'numpy.random._pickle', 'numpy.random', 'numpy.ctypeslib', 'numpy.ma.core', 'numpy.ma.extras', 'numpy.ma', 'numpy', 'packaging.__about__', 'packaging', 'typing.io', 'typing.re', 'typing', 'packaging._structures', 'packaging.version', 'matplotlib._api.deprecation', 'matplotlib._api', 'matplotlib._version', 'gzip', 'shlex', 'matplotlib._c_internal_utils', 'matplotlib.cbook', 'matplotlib.docstring', 'copy', 'PIL._version', 'PIL', 'PIL.ImageMode', 'PIL.TiffTags', 'PIL._binary', 'PIL._deprecate', 'PIL._util', 'PIL._imaging', 'PIL.Image', 'PIL.ImageChops', 'PIL.ImageFile', 'array', 'PIL.GimpGradientFile', 'PIL.GimpPaletteFile', 'PIL.ImageColor', 'PIL.PaletteFile', 'PIL.ImagePalette', 'PIL.ImageSequence', 'PIL.PngImagePlugin', 'matplotlib._path', 'matplotlib.bezier', 'matplotlib.path', 'matplotlib.transforms', 'matplotlib.ticker', 'matplotlib.scale', 'matplotlib._color_data', 'matplotlib.colors', 'pyparsing.util', 'pyparsing.unicode', 'pyparsing.exceptions', 'pyparsing.actions', 'pyparsing.results', 'pyparsing.core', 'html.entities', 'html', 'pyparsing.helpers', 'pyparsing.testing', 'pyparsing.common', 'pyparsing', 'matplotlib.fontconfig_pattern', 'matplotlib._enums', 'cycler', 'matplotlib.rcsetup', 'matplotlib.ft2font', 'dateutil._version', 'dateutil', 'kiwisolver._cext', 'kiwisolver', 'matplotlib._cm', 'matplotlib._cm_listed', 'matplotlib.cm', 'matplotlib', 'sitecustomize', 'site'])

sys.getdefaultencoding(

默认编码格式

print(sys.getdefaultencoding())
#utf-8

查看默认递归深度和设置方法

print(sys.getrecursionlimit())
sys.setrecursionlimit(10000)
print(sys.getrecursionlimit())
1000
10000

获取windows版本

print(sys.getwindowsversion())
#sys.getwindowsversion(major=10, minor=0, build=19041, platform=2, service_pack='')

IDLE 界面修改提示格式

 每次打开 Python 的交互式界面,我们都会看到一个提示符>>>。不知道你有没有想过要把这个东西换成另外的什么呢?

就这俩货:sys.ps1sys.ps2

所谓“ps”,应当是“prompts”的简写,即“提示符”。

这两个属性中,sys.ps1代表的是一级提示符,也就是进入 Python 交互界面之后就会出现的那一个>>>;而第二个sys.ps2则是二级提示符,是在同一级内容没有输入完,换行之后新行行首的提示符...。当然,两个属性都是字符串。

>>> import sys
>>> sys.ps1 = '~'
~print('hahaha')
hahaha
~
posted @ 2023-06-19 07:50  晓枫的春天  阅读(330)  评论(0编辑  收藏  举报