|
|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
\# Отчет по Теме 8
|
|
|
|
|
# Отчет по Теме 8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -6,11 +6,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
\## 1 Создание и использование модулей в среде Python
|
|
|
|
|
## 1 Создание и использование модулей в среде Python
|
|
|
|
|
|
|
|
|
|
Создадим модуль Mod1:
|
|
|
|
|
|
|
|
|
|
!\[Mod1.PNG](Mod1.PNG)
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
@ -22,7 +22,7 @@ Mod1:Значение perm1= 5
|
|
|
|
|
|
|
|
|
|
>>> dir(Mod1)
|
|
|
|
|
|
|
|
|
|
\['\_\_builtins\_\_', '\_\_cached\_\_', '\_\_doc\_\_', '\_\_file\_\_', '\_\_loader\_\_', '\_\_name\_\_', '\_\_package\_\_', '\_\_spec\_\_', 'perm1']
|
|
|
|
|
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'perm1']
|
|
|
|
|
|
|
|
|
|
>>> type(Mod1)
|
|
|
|
|
|
|
|
|
|
@ -42,7 +42,7 @@ Mod1:Введите значение = 3
|
|
|
|
|
|
|
|
|
|
Mod1:Значение perm1= 3
|
|
|
|
|
|
|
|
|
|
<module 'Mod1' from 'D:\\\\!!!Download\\\\Documents\\\\учёба МЭИ\\\\5 СЕМЕСТР\\\\GIT\\\\python-labs\\\\TEMA8\\\\Mod1.py'>
|
|
|
|
|
<module 'Mod1' from 'D:\\!!!Download\\Documents\\учёба МЭИ\\5 СЕМЕСТР\\GIT\\python-labs\\TEMA8\\Mod1.py'>
|
|
|
|
|
|
|
|
|
|
>>> Mod1.perm1
|
|
|
|
|
|
|
|
|
|
@ -52,11 +52,11 @@ Mod1:Значение perm1= 3
|
|
|
|
|
|
|
|
|
|
>>> print(sorted(sys.modules.keys()))
|
|
|
|
|
|
|
|
|
|
\['Mod1', '\_\_future\_\_', '\_\_main\_\_', '\_abc', '\_ast', '\_bisect', '\_bz2', '\_codecs', '\_collections', '\_collections\_abc', '\_colorize', '\_compat\_pickle', '\_compression', '\_datetime', '\_distutils\_hack', '\_frozen\_importlib', '\_frozen\_importlib\_external', '\_functools', '\_heapq', '\_imp', '\_io', '\_lzma', '\_opcode', '\_opcode\_metadata', '\_operator', '\_pickle', '\_pyrepl', '\_pyrepl.pager', '\_queue', '\_random', '\_signal', '\_sitebuiltins', '\_socket', '\_sre', '\_stat', '\_string', '\_struct', '\_sysconfig', '\_thread', '\_tkinter', '\_tokenize', '\_typing', '\_warnings', '\_weakref', '\_weakrefset', '\_winapi', '\_wmi', 'abc', 'ast', 'bdb', 'binascii', 'bisect', 'builtins', 'bz2', 'codecs', 'collections', 'collections.abc', 'configparser', 'contextlib', 'copyreg', 'datetime', 'dis', 'encodings', 'encodings.aliases', 'encodings.cp1251', 'encodings.utf\_8', 'encodings.utf\_8\_sig', 'enum', 'errno', 'fnmatch', 'functools', 'genericpath', 'heapq', 'idlelib', 'idlelib.autocomplete', 'idlelib.autocomplete\_w', 'idlelib.calltip', 'idlelib.calltip\_w', 'idlelib.config', 'idlelib.debugger', 'idlelib.debugger\_r', 'idlelib.debugobj', 'idlelib.debugobj\_r', 'idlelib.hyperparser', 'idlelib.iomenu', 'idlelib.macosx', 'idlelib.multicall', 'idlelib.pyparse', 'idlelib.rpc', 'idlelib.run', 'idlelib.scrolledlist', 'idlelib.stackviewer', 'idlelib.tooltip', 'idlelib.tree', 'idlelib.util', 'idlelib.window', 'idlelib.zoomheight', 'importlib', 'importlib.\_abc', 'importlib.\_bootstrap', 'importlib.\_bootstrap\_external', 'importlib.machinery', 'importlib.util', 'inspect', 'io', 'ipaddress', 'itertools', 'keyword', 'linecache', 'lzma', 'marshal', 'math', 'nt', 'ntpath', 'opcode', 'operator', 'os', 'os.path', 'pickle', 'pkgutil', 'platform', 'plistlib', 'posixpath', 'pydoc', 'pyexpat', 'pyexpat.errors', 'pyexpat.model', 'queue', 'random', 're', 're.\_casefix', 're.\_compiler', 're.\_constants', 're.\_parser', 'reprlib', 'select', 'selectors', 'shlex', 'shutil', 'site', 'socket', 'socketserver', 'stat', 'string', 'struct', 'sys', 'sysconfig', 'tempfile', 'textwrap', 'threading', 'time', 'tkinter', 'tkinter.constants', 'token', 'tokenize', 'traceback', 'types', 'typing', 'urllib', 'urllib.parse', 'warnings', 'weakref', 'winreg', 'xml', 'xml.parsers', 'xml.parsers.expat', 'xml.parsers.expat.errors', 'xml.parsers.expat.model', 'zipimport', 'zlib']
|
|
|
|
|
['Mod1', '\_\_future\_\_', '\_\_main\_\_', '\_abc', '\_ast', '\_bisect', '\_bz2', '\_codecs', '\_collections', '\_collections\_abc', '\_colorize', '\_compat\_pickle', '\_compression', '\_datetime', '\_distutils\_hack', '\_frozen\_importlib', '\_frozen\_importlib\_external', '\_functools', '\_heapq', '\_imp', '\_io', '\_lzma', '\_opcode', '\_opcode\_metadata', '\_operator', '\_pickle', '\_pyrepl', '\_pyrepl.pager', '\_queue', '\_random', '\_signal', '\_sitebuiltins', '\_socket', '\_sre', '\_stat', '\_string', '\_struct', '\_sysconfig', '\_thread', '\_tkinter', '\_tokenize', '\_typing', '\_warnings', '\_weakref', '\_weakrefset', '\_winapi', '\_wmi', 'abc', 'ast', 'bdb', 'binascii', 'bisect', 'builtins', 'bz2', 'codecs', 'collections', 'collections.abc', 'configparser', 'contextlib', 'copyreg', 'datetime', 'dis', 'encodings', 'encodings.aliases', 'encodings.cp1251', 'encodings.utf\_8', 'encodings.utf\_8\_sig', 'enum', 'errno', 'fnmatch', 'functools', 'genericpath', 'heapq', 'idlelib', 'idlelib.autocomplete', 'idlelib.autocomplete\_w', 'idlelib.calltip', 'idlelib.calltip\_w', 'idlelib.config', 'idlelib.debugger', 'idlelib.debugger\_r', 'idlelib.debugobj', 'idlelib.debugobj\_r', 'idlelib.hyperparser', 'idlelib.iomenu', 'idlelib.macosx', 'idlelib.multicall', 'idlelib.pyparse', 'idlelib.rpc', 'idlelib.run', 'idlelib.scrolledlist', 'idlelib.stackviewer', 'idlelib.tooltip', 'idlelib.tree', 'idlelib.util', 'idlelib.window', 'idlelib.zoomheight', 'importlib', 'importlib.\_abc', 'importlib.\_bootstrap', 'importlib.\_bootstrap\_external', 'importlib.machinery', 'importlib.util', 'inspect', 'io', 'ipaddress', 'itertools', 'keyword', 'linecache', 'lzma', 'marshal', 'math', 'nt', 'ntpath', 'opcode', 'operator', 'os', 'os.path', 'pickle', 'pkgutil', 'platform', 'plistlib', 'posixpath', 'pydoc', 'pyexpat', 'pyexpat.errors', 'pyexpat.model', 'queue', 'random', 're', 're.\_casefix', 're.\_compiler', 're.\_constants', 're.\_parser', 'reprlib', 'select', 'selectors', 'shlex', 'shutil', 'site', 'socket', 'socketserver', 'stat', 'string', 'struct', 'sys', 'sysconfig', 'tempfile', 'textwrap', 'threading', 'time', 'tkinter', 'tkinter.constants', 'token', 'tokenize', 'traceback', 'types', 'typing', 'urllib', 'urllib.parse', 'warnings', 'weakref', 'winreg', 'xml', 'xml.parsers', 'xml.parsers.expat', 'xml.parsers.expat.errors', 'xml.parsers.expat.model', 'zipimport', 'zlib']
|
|
|
|
|
|
|
|
|
|
>>> sys.modules.pop('Mod1')
|
|
|
|
|
|
|
|
|
|
<module 'Mod1' from 'D:\\\\!!!Download\\\\Documents\\\\учёба МЭИ\\\\5 СЕМЕСТР\\\\GIT\\\\python-labs\\\\TEMA8\\\\Mod1.py'>
|
|
|
|
|
<module 'Mod1' from 'D:\\!!!Download\\Documents\\учёба МЭИ\\5 СЕМЕСТР\\GIT\\python-labs\\TEMA8\\Mod1.py'>
|
|
|
|
|
|
|
|
|
|
>>> print(sorted(sys.modules.keys()))
|
|
|
|
|
|
|
|
|
|
@ -158,7 +158,7 @@ Mod1:Значение perm1= 2
|
|
|
|
|
|
|
|
|
|
Теперь создадим модуль Mod2:
|
|
|
|
|
|
|
|
|
|
!\[Mod2.PNG](Mod2.PNG)
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
@ -182,9 +182,9 @@ print(sorted(sys.modules.keys()))
|
|
|
|
|
|
|
|
|
|
Traceback (most recent call last):
|
|
|
|
|
|
|
|
|
|
File "<pyshell#35>", line 1, in <module>
|
|
|
|
|
File "<pyshell#35>", line 1, in <module>
|
|
|
|
|
|
|
|
|
|
alpha()
|
|
|
|
|
alpha()
|
|
|
|
|
|
|
|
|
|
NameError: name 'alpha' is not defined
|
|
|
|
|
|
|
|
|
|
@ -192,9 +192,9 @@ NameError: name 'alpha' is not defined
|
|
|
|
|
|
|
|
|
|
Traceback (most recent call last):
|
|
|
|
|
|
|
|
|
|
File "<pyshell#36>", line 1, in <module>
|
|
|
|
|
File "<pyshell#36>", line 1, in <module>
|
|
|
|
|
|
|
|
|
|
beta()
|
|
|
|
|
beta()
|
|
|
|
|
|
|
|
|
|
TypeError: beta() missing 1 required positional argument: 'q'
|
|
|
|
|
|
|
|
|
|
@ -202,7 +202,7 @@ TypeError: beta() missing 1 required positional argument: 'q'
|
|
|
|
|
|
|
|
|
|
>>> al()
|
|
|
|
|
|
|
|
|
|
\*\*\*\*ALPHA\*\*\*\*
|
|
|
|
|
****ALPHA****
|
|
|
|
|
|
|
|
|
|
Значение t=2
|
|
|
|
|
|
|
|
|
|
@ -218,7 +218,7 @@ TypeError: beta() missing 1 required positional argument: 'q'
|
|
|
|
|
|
|
|
|
|
>>> tt=alpha()
|
|
|
|
|
|
|
|
|
|
\*\*\*\*ALPHA\*\*\*\*
|
|
|
|
|
****ALPHA****
|
|
|
|
|
|
|
|
|
|
Значение t=0.12
|
|
|
|
|
|
|
|
|
|
@ -230,13 +230,13 @@ TypeError: beta() missing 1 required positional argument: 'q'
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
\## 2 Создание многомодульных программ
|
|
|
|
|
## 2 Создание многомодульных программ
|
|
|
|
|
|
|
|
|
|
```PY
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
>>> print(sorted(sys.modules.keys()))
|
|
|
|
|
|
|
|
|
|
\['Mod1', 'Mod2', '\_\_future\_\_', '\_\_main\_\_', '\_abc', '\_ast', '\_bisect', '\_bz2', '\_codecs', '\_collections', '\_collections\_abc', '\_colorize', '\_compat\_pickle', '\_compression', '\_datetime', '\_distutils\_hack', '\_frozen\_importlib', '\_frozen\_importlib\_external', '\_functools', '\_heapq', '\_imp', '\_io', '\_lzma', '\_opcode', '\_opcode\_metadata', '\_operator', '\_pickle', '\_pyrepl', '\_pyrepl.pager', '\_queue', '\_random', '\_signal', '\_sitebuiltins', '\_socket', '\_sre', '\_stat', '\_string', '\_struct', '\_sysconfig', '\_thread', '\_tkinter', '\_tokenize', '\_typing', '\_warnings', '\_weakref', '\_weakrefset', '\_winapi', '\_wmi', 'abc', 'ast', 'bdb', 'binascii', 'bisect', 'builtins', 'bz2', 'codecs', 'collections', 'collections.abc', 'configparser', 'contextlib', 'copyreg', 'datetime', 'dis', 'encodings', 'encodings.aliases', 'encodings.cp1251', 'encodings.utf\_8', 'encodings.utf\_8\_sig', 'enum', 'errno', 'fnmatch', 'functools', 'genericpath', 'heapq', 'idlelib', 'idlelib.autocomplete', 'idlelib.autocomplete\_w', 'idlelib.calltip', 'idlelib.calltip\_w', 'idlelib.config', 'idlelib.debugger', 'idlelib.debugger\_r', 'idlelib.debugobj', 'idlelib.debugobj\_r', 'idlelib.hyperparser', 'idlelib.iomenu', 'idlelib.macosx', 'idlelib.multicall', 'idlelib.pyparse', 'idlelib.rpc', 'idlelib.run', 'idlelib.scrolledlist', 'idlelib.stackviewer', 'idlelib.tooltip', 'idlelib.tree', 'idlelib.util', 'idlelib.window', 'idlelib.zoomheight', 'importlib', 'importlib.\_abc', 'importlib.\_bootstrap', 'importlib.\_bootstrap\_external', 'importlib.machinery', 'importlib.util', 'inspect', 'io', 'ipaddress', 'itertools', 'keyword', 'linecache', 'lzma', 'marshal', 'math', 'nt', 'ntpath', 'opcode', 'operator', 'os', 'os.path', 'pickle', 'pkgutil', 'platform', 'plistlib', 'posixpath', 'pydoc', 'pyexpat', 'pyexpat.errors', 'pyexpat.model', 'queue', 'random', 're', 're.\_casefix', 're.\_compiler', 're.\_constants', 're.\_parser', 'reprlib', 'select', 'selectors', 'shlex', 'shutil', 'site', 'socket', 'socketserver', 'stat', 'string', 'struct', 'sys', 'sysconfig', 'tempfile', 'textwrap', 'threading', 'time', 'tkinter', 'tkinter.constants', 'token', 'tokenize', 'traceback', 'types', 'typing', 'urllib', 'urllib.parse', 'warnings', 'weakref', 'winreg', 'xml', 'xml.parsers', 'xml.parsers.expat', 'xml.parsers.expat.errors', 'xml.parsers.expat.model', 'zipimport', 'zlib']
|
|
|
|
|
['Mod1', 'Mod2', '\_\_future\_\_', '\_\_main\_\_', '\_abc', '\_ast', '\_bisect', '\_bz2', '\_codecs', '\_collections', '\_collections\_abc', '\_colorize', '\_compat\_pickle', '\_compression', '\_datetime', '\_distutils\_hack', '\_frozen\_importlib', '\_frozen\_importlib\_external', '\_functools', '\_heapq', '\_imp', '\_io', '\_lzma', '\_opcode', '\_opcode\_metadata', '\_operator', '\_pickle', '\_pyrepl', '\_pyrepl.pager', '\_queue', '\_random', '\_signal', '\_sitebuiltins', '\_socket', '\_sre', '\_stat', '\_string', '\_struct', '\_sysconfig', '\_thread', '\_tkinter', '\_tokenize', '\_typing', '\_warnings', '\_weakref', '\_weakrefset', '\_winapi', '\_wmi', 'abc', 'ast', 'bdb', 'binascii', 'bisect', 'builtins', 'bz2', 'codecs', 'collections', 'collections.abc', 'configparser', 'contextlib', 'copyreg', 'datetime', 'dis', 'encodings', 'encodings.aliases', 'encodings.cp1251', 'encodings.utf\_8', 'encodings.utf\_8\_sig', 'enum', 'errno', 'fnmatch', 'functools', 'genericpath', 'heapq', 'idlelib', 'idlelib.autocomplete', 'idlelib.autocomplete\_w', 'idlelib.calltip', 'idlelib.calltip\_w', 'idlelib.config', 'idlelib.debugger', 'idlelib.debugger\_r', 'idlelib.debugobj', 'idlelib.debugobj\_r', 'idlelib.hyperparser', 'idlelib.iomenu', 'idlelib.macosx', 'idlelib.multicall', 'idlelib.pyparse', 'idlelib.rpc', 'idlelib.run', 'idlelib.scrolledlist', 'idlelib.stackviewer', 'idlelib.tooltip', 'idlelib.tree', 'idlelib.util', 'idlelib.window', 'idlelib.zoomheight', 'importlib', 'importlib.\_abc', 'importlib.\_bootstrap', 'importlib.\_bootstrap\_external', 'importlib.machinery', 'importlib.util', 'inspect', 'io', 'ipaddress', 'itertools', 'keyword', 'linecache', 'lzma', 'marshal', 'math', 'nt', 'ntpath', 'opcode', 'operator', 'os', 'os.path', 'pickle', 'pkgutil', 'platform', 'plistlib', 'posixpath', 'pydoc', 'pyexpat', 'pyexpat.errors', 'pyexpat.model', 'queue', 'random', 're', 're.\_casefix', 're.\_compiler', 're.\_constants', 're.\_parser', 'reprlib', 'select', 'selectors', 'shlex', 'shutil', 'site', 'socket', 'socketserver', 'stat', 'string', 'struct', 'sys', 'sysconfig', 'tempfile', 'textwrap', 'threading', 'time', 'tkinter', 'tkinter.constants', 'token', 'tokenize', 'traceback', 'types', 'typing', 'urllib', 'urllib.parse', 'warnings', 'weakref', 'winreg', 'xml', 'xml.parsers', 'xml.parsers.expat', 'xml.parsers.expat.errors', 'xml.parsers.expat.model', 'zipimport', 'zlib']
|
|
|
|
|
|
|
|
|
|
>>> sys.modules.pop('Mod1')
|
|
|
|
|
|
|
|
|
|
@ -248,13 +248,13 @@ TypeError: beta() missing 1 required positional argument: 'q'
|
|
|
|
|
|
|
|
|
|
>>> print(sorted(sys.modules.keys()))
|
|
|
|
|
|
|
|
|
|
\['\_\_future\_\_', '\_\_main\_\_', '\_abc', '\_ast', '\_bisect', '\_bz2', '\_codecs', '\_collections', '\_collections\_abc', '\_colorize', '\_compat\_pickle', '\_compression', '\_datetime', '\_distutils\_hack', '\_frozen\_importlib', '\_frozen\_importlib\_external', '\_functools', '\_heapq', '\_imp', '\_io', '\_lzma', '\_opcode', '\_opcode\_metadata', '\_operator', '\_pickle', '\_pyrepl', '\_pyrepl.pager', '\_queue', '\_random', '\_signal', '\_sitebuiltins', '\_socket', '\_sre', '\_stat', '\_string', '\_struct', '\_sysconfig', '\_thread', '\_tkinter', '\_tokenize', '\_typing', '\_warnings', '\_weakref', '\_weakrefset', '\_winapi', '\_wmi', 'abc', 'ast', 'bdb', 'binascii', 'bisect', 'builtins', 'bz2', 'codecs', 'collections', 'collections.abc', 'configparser', 'contextlib', 'copyreg', 'datetime', 'dis', 'encodings', 'encodings.aliases', 'encodings.cp1251', 'encodings.utf\_8', 'encodings.utf\_8\_sig', 'enum', 'errno', 'fnmatch', 'functools', 'genericpath', 'heapq', 'idlelib', 'idlelib.autocomplete', 'idlelib.autocomplete\_w', 'idlelib.calltip', 'idlelib.calltip\_w', 'idlelib.config', 'idlelib.debugger', 'idlelib.debugger\_r', 'idlelib.debugobj', 'idlelib.debugobj\_r', 'idlelib.hyperparser', 'idlelib.iomenu', 'idlelib.macosx', 'idlelib.multicall', 'idlelib.pyparse', 'idlelib.rpc', 'idlelib.run', 'idlelib.scrolledlist', 'idlelib.stackviewer', 'idlelib.tooltip', 'idlelib.tree', 'idlelib.util', 'idlelib.window', 'idlelib.zoomheight', 'importlib', 'importlib.\_abc', 'importlib.\_bootstrap', 'importlib.\_bootstrap\_external', 'importlib.machinery', 'importlib.util', 'inspect', 'io', 'ipaddress', 'itertools', 'keyword', 'linecache', 'lzma', 'marshal', 'math', 'nt', 'ntpath', 'opcode', 'operator', 'os', 'os.path', 'pickle', 'pkgutil', 'platform', 'plistlib', 'posixpath', 'pydoc', 'pyexpat', 'pyexpat.errors', 'pyexpat.model', 'queue', 'random', 're', 're.\_casefix', 're.\_compiler', 're.\_constants', 're.\_parser', 'reprlib', 'select', 'selectors', 'shlex', 'shutil', 'site', 'socket', 'socketserver', 'stat', 'string', 'struct', 'sys', 'sysconfig', 'tempfile', 'textwrap', 'threading', 'time', 'tkinter', 'tkinter.constants', 'token', 'tokenize', 'traceback', 'types', 'typing', 'urllib', 'urllib.parse', 'warnings', 'weakref', 'winreg', 'xml', 'xml.parsers', 'xml.parsers.expat', 'xml.parsers.expat.errors', 'xml.parsers.expat.model', 'zipimport', 'zlib']
|
|
|
|
|
['\_\_future\_\_', '\_\_main\_\_', '\_abc', '\_ast', '\_bisect', '\_bz2', '\_codecs', '\_collections', '\_collections\_abc', '\_colorize', '\_compat\_pickle', '\_compression', '\_datetime', '\_distutils\_hack', '\_frozen\_importlib', '\_frozen\_importlib\_external', '\_functools', '\_heapq', '\_imp', '\_io', '\_lzma', '\_opcode', '\_opcode\_metadata', '\_operator', '\_pickle', '\_pyrepl', '\_pyrepl.pager', '\_queue', '\_random', '\_signal', '\_sitebuiltins', '\_socket', '\_sre', '\_stat', '\_string', '\_struct', '\_sysconfig', '\_thread', '\_tkinter', '\_tokenize', '\_typing', '\_warnings', '\_weakref', '\_weakrefset', '\_winapi', '\_wmi', 'abc', 'ast', 'bdb', 'binascii', 'bisect', 'builtins', 'bz2', 'codecs', 'collections', 'collections.abc', 'configparser', 'contextlib', 'copyreg', 'datetime', 'dis', 'encodings', 'encodings.aliases', 'encodings.cp1251', 'encodings.utf\_8', 'encodings.utf\_8\_sig', 'enum', 'errno', 'fnmatch', 'functools', 'genericpath', 'heapq', 'idlelib', 'idlelib.autocomplete', 'idlelib.autocomplete\_w', 'idlelib.calltip', 'idlelib.calltip\_w', 'idlelib.config', 'idlelib.debugger', 'idlelib.debugger\_r', 'idlelib.debugobj', 'idlelib.debugobj\_r', 'idlelib.hyperparser', 'idlelib.iomenu', 'idlelib.macosx', 'idlelib.multicall', 'idlelib.pyparse', 'idlelib.rpc', 'idlelib.run', 'idlelib.scrolledlist', 'idlelib.stackviewer', 'idlelib.tooltip', 'idlelib.tree', 'idlelib.util', 'idlelib.window', 'idlelib.zoomheight', 'importlib', 'importlib.\_abc', 'importlib.\_bootstrap', 'importlib.\_bootstrap\_external', 'importlib.machinery', 'importlib.util', 'inspect', 'io', 'ipaddress', 'itertools', 'keyword', 'linecache', 'lzma', 'marshal', 'math', 'nt', 'ntpath', 'opcode', 'operator', 'os', 'os.path', 'pickle', 'pkgutil', 'platform', 'plistlib', 'posixpath', 'pydoc', 'pyexpat', 'pyexpat.errors', 'pyexpat.model', 'queue', 'random', 're', 're.\_casefix', 're.\_compiler', 're.\_constants', 're.\_parser', 'reprlib', 'select', 'selectors', 'shlex', 'shutil', 'site', 'socket', 'socketserver', 'stat', 'string', 'struct', 'sys', 'sysconfig', 'tempfile', 'textwrap', 'threading', 'time', 'tkinter', 'tkinter.constants', 'token', 'tokenize', 'traceback', 'types', 'typing', 'urllib', 'urllib.parse', 'warnings', 'weakref', 'winreg', 'xml', 'xml.parsers', 'xml.parsers.expat', 'xml.parsers.expat.errors', 'xml.parsers.expat.model', 'zipimport', 'zlib']
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Создадим модуль Mod0:
|
|
|
|
|
|
|
|
|
|
!\[Mod0.PNG](Mod0.PNG)
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
@ -288,15 +288,15 @@ qq= 535.4916555247646
|
|
|
|
|
|
|
|
|
|
MM0:
|
|
|
|
|
|
|
|
|
|
!\[MM0.PNG](MM0.PNG)
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
MM1:
|
|
|
|
|
|
|
|
|
|
!\[MM1.PNG](MM1.PNG)
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
MM2:
|
|
|
|
|
|
|
|
|
|
!\[MM2.PNG](MM2.PNG)
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
Запуск модуля MM0:
|
|
|
|
|
|
|
|
|
|
@ -312,13 +312,13 @@ y= \[0, 0, -2062.187673241671, 3752502.2801429303, -6811818291.756302, 123652974
|
|
|
|
|
|
|
|
|
|
Обращение к beta внутри alpha:
|
|
|
|
|
|
|
|
|
|
!\[btinal.PNG](btinal.PNG)
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Обращение к alpha внутри beta:
|
|
|
|
|
|
|
|
|
|
!\[alinbt.PNG](alinbt.PNG)
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
```PY
|
|
|
|
|
|
|
|
|
|
@ -354,7 +354,7 @@ y= \[0, 0, -2062.187673241671, 3752502.2801429303, -6811818291.756302, 123652974
|
|
|
|
|
|
|
|
|
|
Теперь попробуем отобразить на экране в модуле Mod0 значения объектов t и expi:
|
|
|
|
|
|
|
|
|
|
!\[exp2.PNG](exp2.PNG)
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
@ -376,9 +376,9 @@ qq= 535.4916555247646
|
|
|
|
|
|
|
|
|
|
Traceback (most recent call last):
|
|
|
|
|
|
|
|
|
|
File "D:\\!!!Download\\Documents\\учёба МЭИ\\5 СЕМЕСТР\\GIT\\python-labs\\TEMA8\\Mod0.py", line 11, in <module>
|
|
|
|
|
File "D:\\!!!Download\\Documents\\учёба МЭИ\\5 СЕМЕСТР\\GIT\\python-labs\\TEMA8\\Mod0.py", line 11, in <module>
|
|
|
|
|
|
|
|
|
|
print(al.t)
|
|
|
|
|
print(al.t)
|
|
|
|
|
|
|
|
|
|
AttributeError: 'function' object has no attribute 't'
|
|
|
|
|
|
|
|
|
|
@ -402,9 +402,9 @@ qq= 23.140692632779267
|
|
|
|
|
|
|
|
|
|
Traceback (most recent call last):
|
|
|
|
|
|
|
|
|
|
File "D:\\!!!Download\\Documents\\учёба МЭИ\\5 СЕМЕСТР\\GIT\\python-labs\\TEMA8\\Mod0.py", line 12, in <module>
|
|
|
|
|
File "D:\\!!!Download\\Documents\\учёба МЭИ\\5 СЕМЕСТР\\GIT\\python-labs\\TEMA8\\Mod0.py", line 12, in <module>
|
|
|
|
|
|
|
|
|
|
print(beta.expi)
|
|
|
|
|
print(beta.expi)
|
|
|
|
|
|
|
|
|
|
AttributeError: 'function' object has no attribute 'expi'
|
|
|
|
|
|
|
|
|
|
@ -420,7 +420,7 @@ AttributeError: 'function' object has no attribute 'expi'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!\[exp3.PNG](exp3.PNG)
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
```py
|
|
|
|
|
|
|
|
|
|
|