1、函数位置__code__
import os
print(os.walk.__code__)
输出:
<code object walk at 0x0000000001DB7DB0, file "C:Program Files (x86)python3.6libos.py", line 277>
2、模块位置__file__
import os
print(os.__file__)
输出:
C:Program Files (x86)python3.6libos.py
1、函数位置__code__
import os
print(os.walk.__code__)
输出:
<code object walk at 0x0000000001DB7DB0, file "C:Program Files (x86)python3.6libos.py", line 277>
2、模块位置__file__
import os
print(os.__file__)
输出:
C:Program Files (x86)python3.6libos.py