0 votes
1 view
in Python by (1.6k points)

How to get the filename without the extension from a path in Python?

1 Answer

0 votes
by (25.1k points)

You can do it like this:

import os

print(os.path.splitext("/path/to/some/file.txt")[0])

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jul 18, 2019 in Python by Sammy (47.8k points)
0 votes
1 answer
asked Jul 11, 2019 in Java by Ritik (3.5k points)
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...