Answers for "python get path for file in directory"

33

python get filename from path

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

python get files in directory

(_, _, filenames) = os.walk(mypath).next() #if you are confident that the walk will return at least one value
Posted by: Guest on August-31-2021

Code answers related to "python get path for file in directory"

Python Answers by Framework

Browse Popular Code Answers by Language