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

2018-11-16  本文已影响0人  reallocing
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'
上一篇 下一篇

猜你喜欢

热点阅读