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 458 views
2 answers 409 views
1 answer 353 views
3 answers 529 views
1 answer 514 views
1 answer 330 views
...