Making a txt file then write 1

Making a txt file then write

#open text file
text_file = open("C:/Users/rowgi/Jupyter/Sentimental/Better/pwords.txt", "w")
 
#write string to file
text_file.write(pwords)
 
#close file
text_file.close()

Here is what the above code is Doing:
1. We open the file in write mode.
2. We write the string to the file.
3. We close the file.

Similar Posts