Answers for "get filename in a folder python"

33

python get filename from path

import os
print(os.path.basename(your_path))
Posted by: Guest on February-28-2020
2

python how to get the folder name of a file

# Basic syntax:
import os
os.path.dirname('/path/to/your/favorite/file.txt')
--> '/path/to/your/favorite/'
Posted by: Guest on October-04-2020

Code answers related to "get filename in a folder python"

Python Answers by Framework

Browse Popular Code Answers by Language