1import os
2
3# detect the current working directory
4path = os.getcwd()
5
6# read the entries
7with os.scandir(path) as listOfEntries:
8 for entry in listOfEntries:
9 # print all entries that are files
10 if entry.is_file():
11 print(entry.name)
12
1import pathlib
2
3# define the path
4currentDirectory = pathlib.Path('.')
5
6# define the pattern
7currentPattern = "*.py"
8
9for currentFile in currentDirectory.glob(currentPattern):
10 print(currentFile)
11
1#! /bin/bash
2
3for filename in *.py; do
4 echo "$filename:"
5 cat $filename | python3 -m timeit
6 echo " "
7done
8
1
2import pathlib
3
4# define the path
5currentDirectory = pathlib.Path('.')
6
7for currentFile in currentDirectory.iterdir():
8 print(currentFile)
9