Hello how can I get the file name with os.path lib? For example:
C:\Users\filippo\Desktop\K.java
I want the K without the extension file
I suggest you use the splitext
and basename
functions from os.path
K, ext = os.path.splitext(os.path.basename(my_path))
See the docs here.
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