Python Forum

Full Version: Search for files
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I need to find files in dir path which are greater than zero bytes and print them
Hello, is this a homework assignment?

Show us what you have tried. Post the code in Python code tags and errors in error tags, and we will assist the best we can.
dir_path='/development0/tep/install/D175122/script/'
def is_non_zero_file(dir_path):
    return os.path.isfile(dir_path) and os.path.getsize(dir_path) > 0
file_list=is_non_zero_file()
pirnt(file_list)
You need to pass the dir_path argument to is_non_zero_file
file_list = is_non_zero_file(dir_path)
Thank you