Answers for "python get file in path to list"

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

Python Answers by Framework

Browse Popular Code Answers by Language