Aug-23-2018, 01:03 PM
Seems like i have been running around in circles for the last couple of days trying and failing to write text to a .txt file.
Perhaps i better start at the beginning so that everyone can see exactly what i've been doing and where i am going wrong.
I created an ordinary .txt file called emptyScriptFile.txt and saved it in the folder where i save all my .py script files.
I then created and saved a file called mainScript.py in the same folder as the emptyScriptFile.txt file which has the following contents:
Perhaps i better start at the beginning so that everyone can see exactly what i've been doing and where i am going wrong.
I created an ordinary .txt file called emptyScriptFile.txt and saved it in the folder where i save all my .py script files.
I then created and saved a file called mainScript.py in the same folder as the emptyScriptFile.txt file which has the following contents:
#!/usr/bin/env python3 text = 'Some simple text to save\nThis is the Second line.' myFile = open('emptyScriptFile.txt', 'w') myFile.write(text) myFile.close()Could someone show me what i've done wrong please