I am beginner in python, and I need to use some thirdparty function which basically has one input – name of a file on a hard drive. This function parses file and then proceses it.
I am generating file contents in my code (it’s CSV file which I generate from a list) and want to skip actual file creation. Is there any way I can achieve this and “hack” the thirdparty function to accept my string without creating a file?
After some googling I found StringIO, and created a file object in it, now I am stuck on passing this object to a function (again, it accepts not a file object but a file name).
If it requires a filename, then you’re going to have to create a file. (And that’s poor design on the part of the library creators.)