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 225 views
2 answers 283 views
2 answers 258 views
1 answer 230 views
3 answers 330 views
1 answer 397 views
1 answer 200 views
...