python os.path.join()

>>> import os
>>> path = '/Users/beazley/Data/data.csv'

>>> # Get the last component of the path
>>> os.path.basename(path)
'data.csv'

>>> # Join path components together
>>> os.path.join('tmp', 'data', os.path.basename(path))
'tmp/data/data.csv'

 起连接作用

扩展路径

posted @ 2019-01-03 15:14  筱筱的春天  阅读(457)  评论(0编辑  收藏  举报