Good afternoon, I ran into a little problem. I want to create a file in a folder that doesn't exist. How can I best do this?
When I specify the path itself with non-existent folders, I get a FileNotFoundError. I also tried to create folders manually and then write the file to them, but I also get the same error.
Thanks in advance for the answer to everyone who was not indifferent
with open('/data/file.txt', 'w', encoding='UTF-8') as file:
file.write(some_data)
Regardless of whether the folder exists, I get the error
Decision - Creating a missing directory / file structure - Python