Is there any way in python to write a string to a text file in your directory without needing the text file to exist first?
I know you can write a text file like this:
a='a'
file1=open('sample.txt','a')
file1=write(a)
file1.close()
but I think this method requires the text file sample.txt to exist already in the working directory. I am wondering if I can write the 'a' to a file without the sample.txt needing to be a pre-existing file.