回答編集履歴
3
__path__ではなく__file__による方法に修正
test
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
-
標準モジュール以外であれば`__
|
7
|
+
標準モジュール以外であれば`__file__`でモジュール(パッケージ)ファイルパスが確認できます。
|
8
8
|
|
9
9
|
参考:[Python Tips:ライブラリ・モジュールの場所を調べたい](http://www.lifewithpython.com/2014/07/python-get-location-of-libraries-modules-packages.html)
|
10
10
|
|
2
__path__について追記
test
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
標準モジュールの一覧は[sys.builtin_module_names](https://docs.python.jp/3/library/sys.html#sys.builtin_module_names)で確認表示できます。
|
4
4
|
|
5
5
|
|
6
|
+
|
7
|
+
標準モジュール以外であれば`__path__`でモジュール(パッケージ)のパスが確認できます。
|
8
|
+
|
9
|
+
参考:[Python Tips:ライブラリ・モジュールの場所を調べたい](http://www.lifewithpython.com/2014/07/python-get-location-of-libraries-modules-packages.html)
|
6
10
|
|
7
11
|
|
8
12
|
|
@@ -12,6 +16,14 @@
|
|
12
16
|
|
13
17
|
print(sys.builtin_module_names)
|
14
18
|
|
19
|
+
import os
|
20
|
+
|
21
|
+
print(os.__file__)
|
22
|
+
|
23
|
+
import http
|
24
|
+
|
25
|
+
print(http.__file__)
|
26
|
+
|
15
27
|
```
|
16
28
|
|
17
29
|
結果例
|
@@ -20,4 +32,8 @@
|
|
20
32
|
|
21
33
|
('_ast', '_bisect', '_codecs', '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', '_collections', '_csv', '_datetime', '_functools', '_heapq', '_imp', '_io', '_json', '_locale', '_lsprof', '_md5', '_multibytecodec', '_opcode', '_operator', '_pickle', '_random', '_sha1', '_sha256', '_sha512', '_signal', '_sre', '_stat', '_string', '_struct', '_symtable', '_thread', '_tracemalloc', '_warnings', '_weakref', '_winapi', 'array', 'atexit', 'audioop', 'binascii', 'builtins', 'cmath', 'errno', 'faulthandler', 'gc', 'itertools', 'marshal', 'math', 'mmap', 'msvcrt', 'nt', 'parser', 'sys', 'time', 'winreg', 'xxsubtype', 'zipimport', 'zlib')
|
22
34
|
|
35
|
+
C:\Program Files\Anaconda3\lib\os.py
|
36
|
+
|
37
|
+
C:\Program Files\Anaconda3\lib\http\__init__.py
|
38
|
+
|
23
39
|
```
|
1
誤字修正
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
`time`
|
1
|
+
`time`モジュールはPython(インタプリタ)内部に[標準モジュール](https://docs.python.jp/3/tutorial/modules.html#standard-modules)として組み込まれています。よって、ファイル検索などしても見つかりません。
|
2
2
|
|
3
3
|
標準モジュールの一覧は[sys.builtin_module_names](https://docs.python.jp/3/library/sys.html#sys.builtin_module_names)で確認表示できます。
|
4
4
|
|