os.path.join()函数:连接两个或更多的路径名组件
如果拼接在后的参数中含有'\'开头的参数,将从'\'开头的参数开始,前面的参数均将失效,并且路径将从对应磁盘的根目录开始。
import os import os Path1 = 'home' Path2 = 'develop' Path3 = 'code' Path10 = Path1 + Path2 + Path3 Path20 = os.path.join(Path1,Path2,Path3) print ('Path10 = ',Path10) print ('Path20 = ',Path20) 打印结果 Path10 = homedevelopcode Path20 = home\develop\code
标签:Path2,Path10,join,Path20,path,os From: https://www.cnblogs.com/Avicii2018/p/16740109.html