Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 python 中os.path.join,我可以加入目录路径
os.path.join
import os os.path.join('/usr','opt', 'bin') '/usr/opt/bin'
我怎样才能合并两条路径?
从
/a/b/c + c/d
得到
/a/b/c/d
如果您确定路径是您给出示例的形式,
os.path.join(os.path.split(p1)[0], p2)
会做的。