os.path.join() - 忽略绝对路径前的参数

os.path.join()会忽略第一个绝对路径之前的参数!

示例:

>>> import os
>>> os.path.join('/home', 'mushroomer')
'/home/mushroomer'
>>> os.path.join('/home', '/mushroomer')
'/mushroomer'
>>> os.path.join('/home', './mushroomer')
'/home/./mushroomer'

 

 参考资料:https://docs.python.org/3.7/library/os.path.html?#module-os.path

posted @ 2020-01-27 23:21  AdjWang  阅读(445)  评论(0编辑  收藏  举报