开发者

What is the difference between sys and os.sys

What is the difference between sys and os.sys in python? I have seen many projects using sys when they have imported os. When I tried dir(sys) and dir(os.sys) they had same functions and their output was same.

I often see code using sys.exit like this, rather than using os.sys.exit, but both do the same thing.

import os   
import sys    
sys.exit()
开发者_JAVA技巧


os.sys is os's "private" name for sys; Python does not hide imports performed in another module. You should not depend on its existence, and should instead import sys directly yourself.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜