I have a process which requires a csv to be created if it does not currently exist. I then open this csv and write some data to it.
with open("foo.csv", "w") as my_empty_csv:
# now you have an empty file already
# This is where I write my data to the file
This is the code i'm currently using, but I don't know what default encoding the file is created in if it doesn't already exist.
What would be the better way to create a file with UTF-8 encoding if the file doesn't exist.