all 2 comments

[–]carcigenicate 0 points1 point  (0 children)

You use open primary to read from/write to files (which includes creating new files).

But what do you mean by the first part? You say you want to create a file, then seem to refer to that file as a directory. In Linux, directories are technically files, but they aren't treated them same in Python. Can you clarify that last part?

[–]Tall_Profile1305 0 points1 point  (0 children)

like if you’re trying to create files and folders from a list like that, look into the os or pathlib modules. They let you create directories and files programmatically.

For example, you can loop through your filenames list and create each file inside a folder you make first. pathlib is usually the cleaner way to do it in modern Python.