While doing WSQ12 ‘Word Count’, I found a way edit a text file and save what the user wants to write. The only problem about it is that this code is in basic phase, and it will overwrite the text file. This means that if you run it twice, the first text that was written in the first run will be deleted in order to write what was given in the second run. Anyways, here is how to do it. You can look it at my GitHub with comments.
text = str(input("Submit what you want to write: "))
file = open(“Test2.txt”,”w”)
An empty file was used for testing and this is what happened after the first run of the code.
Let’s relax now from this short post. Here is a relaxing song for you: “Run Off The Road” by Ola Podrida. Hope you enjoy the calm of the acoustic guitar and the perfect harmony of the lyrics.