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 233 views
2 answers 297 views
2 answers 268 views
1 answer 240 views
3 answers 343 views
1 answer 403 views
1 answer 215 views
...