美文网首页
python技巧-使用os.path.join和os.path.

python技巧-使用os.path.join和os.path.

作者: reallocing | 来源:发表于2018-11-16 15:15 被阅读0次
    image.png
    %timeit os.path.sep.join(['a','b'])
    os.path.sep.join(['a','b'])
    
    The slowest run took 5.00 times longer than the fastest. This could mean that an intermediate result is being cached.
    1000000 loops, best of 3: 238 ns per loop
    'a/b'
    
    %timeit os.path.join('a','b')
    os.path.join('a','b')
    
    The slowest run took 10.76 times longer than the fastest. This could mean that an intermediate result is being cached.
    1000000 loops, best of 3: 643 ns per loop
    'a/b'
    

    相关文章

      网友评论

          本文标题:python技巧-使用os.path.join和os.path.

          本文链接:https://www.haomeiwen.com/subject/iwemfqtx.html