How to get the filename without the extension from a path in Python

1 Answer

0 votes
import os

filename = "/abc/xyz/test.log"

print(os.path.splitext(filename)[0])





'''
run:

/abc/xyz/test

'''

 



answered Jun 5, 2021 by avibootz

Related questions

1 answer 326 views
2 answers 454 views
2 answers 408 views
1 answer 349 views
3 answers 525 views
1 answer 513 views
1 answer 328 views
...