>>> print('1',os.path.join('aaa','/bbb','ccc.txt'))
1 /bbb\ccc.txt
>>> print('1',os.path.join('/aaa','/bbb','ccc.txt'))
1 /bbb\ccc.txt
>>> print('1',os.path.join('/aaa','/bbb','/ccc.txt'))
1 /ccc.txt
>>> print('1',os.path.join('/aaa','bbb','ccc.txt'))
1 /aaa\bbb\ccc.txt
>>> print('1',os.path.join('/aaa','bbb','/ccc.txt'))
1 /ccc.txt
特别地,如果前面的字符里有C:,则无论如何也会被放到结果里!
网友评论