List-Files
Sat 17 May 2025
title: "List Files" author: "Rj" date: 2019-04-20 description: "-" type: technical_note draft: false
from os import listdir
from os.path import isfile, join
def list_files(mypath):
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
for x in onlyfiles:
print(x)
list_files('/tmp/datasets')
credit.zip
occupancy.zip
concrete.zip
energy.zip
spam.zip
game.zip
hobbies.zip
bikeshare.zip
mushroom.zip
Score: 0
Category: file-utils