开发者

inspect.getfile () vs inspect.getsourcefile()

开发者 https://www.devze.com 2023-03-21 10:09 出处:网络
I was just going through the inspect module docs. What exactly is the difference between: inspect.getfile()

I was just going through the inspect module docs.

What exactly is the difference between:

inspect.getfile()

and

inspect.getsourcefile()

开发者_运维知识库I get exactly the same file path (of the module) for both.


getfile():

Return the name of the (text or binary) file in which an object was defined. This will fail with a TypeError if the object is a built-in module, class, or function.

getfile() also returns pyc (compiled) files, where as getsourcefile() will only return source files.

0

精彩评论

暂无评论...
验证码 换一张
取 消