Given a path, e.g.
file_path = 'a.b.c.d.e'
I wish to remove the e
.
This is what I did:
class_path = ('.').join(file_path.split('.')[0:-1])
Any more elegant way to do it?
import os
os.path.splitext(file_path)[0]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With