os.path.join的用法--拼写路径

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

上一篇:Python:os.path.join()函数


下一篇:python路径拼接os.path.join()函数的用法