os.path.join()函数

**os.path.join() 函数用于拼接文件路径,可以传入多个参数。**自动添加/

import os

print os.path.join('111','222','333')  #111/222/333
print os.path.join('/111','222','333') #/111/222/333
print os.path.join('/111','/222','333') #/222/333

print os.path.join('/111','/222','/333') #/333

print os.path.join('111','222','/333') #/333
print os.path.join('111','/222','/333') #/333
print os.path.join('/111','/222','/333') #/333

print os.path.join('111/','222','333') #111/222/333
print os.path.join('111/','222/','333') #111/222/333
print os.path.join('111/','222/','333/') #111/222/333/

print os.path.join('111','222','333/') #111/222/333/
print os.path.join('111','222/','333/') #111/222/333/
print os.path.join('111/','222/','333/') #111/222/333/

print os.path.join('111','222','./333') #111/222/./333

os.path.join()函数_第1张图片

你可能感兴趣的:(Python,深度学习,人工智能,tensorflow)