提取目录文件的文件名

2017-09-08  本文已影响0人  郑司令
os.path.splitext(infile)[0]

测试:

>>> s = 'c\\hello.txt'
>>> os.path.splitext(s)
('c\\hello', '.txt')
上一篇 下一篇

猜你喜欢

热点阅读