sys.modules/path, built-in modules

Lima·2021년 2월 23일
0

python

목록 보기
4/6
post-thumbnail

sys.modules

dictionary including imported modules and packages.

sys.path

list of strings(path of files)

sys?

<module 'sys' (built-in)>

https://docs.python.org/3/library/sys.html#sys.builtin_module_names

>>> sys.builtin_module_names

('_abc', '_ast', '_bisect', '_blake2', '_codecs', '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', '_collections', '_contextvars', '_csv', '_datetime', '_functools', '_heapq', '_imp', '_io', '_json', '_locale', '_lsprof', '_md5', '_multibytecodec', '_opcode', '_operator', '_peg_parser', '_pickle', '_random', '_sha1', '_sha256', '_sha3', '_sha512', '_signal', '_sre', '_stat', '_statistics', '_string', '_struct', '_symtable', '_thread', '_tracemalloc', '_warnings', '_weakref', '_winapi', '_xxsubinterpreters', 'array', 'atexit', 'audioop', 'binascii', 'builtins', 'cmath', 'errno', 'faulthandler', 'gc', 'itertools', 'marshal', 'math', 'mmap', 'msvcrt', 'nt', 'parser', 'sys', 'time', 'winreg', 'xxsubtype', 'zlib')

Absolute/Relative path

Absolute imports may use either the
import <> or from <> import <> syntax,
but relative imports may only use the second form; the reason for this is that:
import XXX.YYY.ZZZ

https://docs.python.org/3/reference/simple_stmts.html#the-import-statement

https://docs.python.org/3/reference/import.html#package-relative-imports

https://www.python.org/dev/peps/pep-0328/#id10

0개의 댓글