class c(object): def __init__(self): self.py = None self.exe = None l = [] for x in list_of_files: l(c()) c.(depending on what x ends on(py or exe)) = x