2009-07-09 50 views

回答

6

從os.py拍攝於CPython的2.6:

if 'posix' in _names: 
    name = 'posix' 
    linesep = '\n' 
    from posix import * 
    try: 
     from posix import _exit 
    except ImportError: 
     pass 
    import posixpath as path 

    import posix 
    __all__.extend(_get_exports_list(posix)) 
    del posix 

elif 'nt' in _names: 
# ... 

sys.modules['os.path'] = path 
from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep, 
    devnull) 

path更早作爲特定於平臺的模塊定義

0

也許os使用import爲?

import posixpath as path 
相關問題