Tuesday, 17 January 2017

list the files in directory based on extension using raw input-python

import os
def openfolder():
    path = raw_input("Enter path extension..")
    files = os.listdir(path)
    fe=raw_input("enter the extension u need...")
    for file in files:
        if file.endswith(fe):
            print(file)


openfolder()

No comments:

Post a Comment