luofeiyu_cu 发表于 2014-07-14 20:50

sys模块的问题

python中模块的定义,模块名+.py.
我的python安装目录中,为何没有看见sys.py的文件,或者是名为sys的文件夹呢?

Perl_Er 发表于 2014-07-14 21:02

回复 1# luofeiyu_cu


    Help on built-in module sys:

NAME
    sys

FILE
    (built-in)

luofeiyu_cu 发表于 2014-07-14 21:28

本帖最后由 luofeiyu_cu 于 2014-07-14 21:29 编辑

这个模块的安装位置在哪里?

>>> os.__file__
'd:\\Python34\\lib\\os.py'
>>> sys.__file__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute '__file__'

icymirror 发表于 2014-07-14 21:50

built-in是内置的意思,就是没有对应的文件,已经提前编译到python里面了。
页: [1]
查看完整版本: sys模块的问题