我正在研究python正则表达式(re.py)源代码。
在re.py中,他们导入了模块sre_compile
import sre_compile我看一下这里的模块sre_compile,他们在第13行导入了模块_sre
import _sre, sys我搜索了模块_sre.py,但我在任何地方都找不到它,我甚至试图
在我的shell中找到_sre.py。
最后,我试着用python解释器找到它。我导入了_sre,并试图查找_sre的__file__属性,但它给出了以下错误:
AttributeError: 'module' object has no attribute '__file__'我在哪里可以找到_sre模块的源代码?
发布于 2013-04-12 18:03:23
_sre是实现大多数re模块功能的C扩展。C扩展通常没有__file__属性。
因此,您要寻找的是_sre.c source file。
https://stackoverflow.com/questions/15968462
复制相似问题