'storing files in list and send them as argument

I have this path "C:\folder1\folder2\file1.xml,file2.xml" I am iterating through folder2 and trying to store the files in a list and send this list further as parameter to a class, but seems I store in my list only strings and not the files themselves.

directory = C:\folder1\folder2\
filesToReturn = []
for file in os.listdir(self.directory):
     self.filesToReturn.append(file)

email = Email(self.filesToReturn)
email.sendEmail()

where Email class is connecting to server and has a method which sends mail. (the context of message is sent but the files I want to attach don't, because the type of them is string)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source