import os import shutil usernames = [x.split(',')[1] for x in open('accounts.csv').readlines()[1:]] print(usernames) for user in usernames: submitpath = f"/home/{user}/submit/HW2/mat_mul.cpp" if os.path.isfile(submitpath): os.mkdir(f"/home/kjp4155/submissions/HW2/{user}") shutil.copy(submitpath, f"/home/kjp4155/submissions/HW2/{user}/mat_mul.cpp") else: print(user, "X")