#!/usr/bin/env python3 import time import os source_files = [name for name in os.listdir() if name[-4:] == ".cpp"] print(source_files) for executable in source_files: cmd = f"g++ {executable} -o {executable[:-4]}" print(f"Executing {cmd}", end="",flush=True) tstart = time.time() os.system(cmd) tend = time.time() duration = tend - tstart print(f" took {duration} seconds")