os.path.join()用于拼接路径。
path1 = "E:/study"
path2 = "seq"
print(os.path.join(path1,path2))
'''
运行结果:
E:/study\seq
'''
运行结果如上述所示,没有拼接成功,查阅博客,path1最后面也需要有"/"
如下:
path1 = "E:/study/" path2 = "seq" print(os.path.join(path1,path2)) ''' 运行结果: E:/study/seq '''