os.path.join路径拼接
#
import os print("0:", os.path.join('/aaa', 'bbb', 'ccc.txt')) #0: /aaa\bbb\ccc.txt 多数这种用法 print("1:",os.path.join('aaaa','/bbbb','ccccc.txt')) #1: /bbbb\ccccc.txt 从后往前看,会从第一个以“/”开头的参数开始拼接,他之前的参数全部丢弃 print("2:",os.path.join('/aaaa','/bbbb','/ccccc.txt')) #2: /ccccc.txt
print("3:",os.path.join('aaaa','./bbb','ccccc.txt')) #3: aaaa\./bbb\ccccc.txt
新战场:https://blog.csdn.net/Stephen___Qin