Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to write in a text file python

file = open("msg.txt", "w")
file.write("my first file
")
file.write("This file
")
file.write("contains three lines
")

file.close()
Source by www.pythontutorial.net #
 
PREVIOUS NEXT
Tagged: #write #text #file #python
ADD COMMENT
Topic
Name
9+3 =