Importing files_part2.py

Home   »   Importing files_part2.py

# Importing glob
import glob

# Selecting the desired extension
extension = 'csv'

# Creating a list to store our file names
result = glob.glob('*.{}'.format(extension))
print(result)

# If the filename order matters to you, you can sort the list using the function sort
result.sort()

Leave a Reply

Your email address will not be published. Required fields are marked *